Skip to content

Commit

Permalink
updated date implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoalbanese committed Jan 30, 2024
1 parent a62d905 commit a1331a9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kirimase",
"version": "0.0.49",
"version": "0.0.50",
"description": "A Rails-like CLI for building full-stack Next.js apps faster",
"main": "index.js",
"type": "module",
Expand Down
15 changes: 13 additions & 2 deletions src/commands/generate/generators/views-with-server-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,9 @@ const createFormComponent = (schema: Schema) => {
const relations = schema.fields.filter(
(field) => field.type.toLowerCase() === "references"
);

const config = readConfigFile();

const relationsFormatted = relations.map((relation) => {
const {
tableNameCapitalised,
Expand Down Expand Up @@ -879,8 +882,16 @@ const ${tableNameSingularCapitalised}Form = ({${
const pending${tableNameSingularCapitalised}: ${tableNameSingularCapitalised} = {
${
schema.includeTimestamps
? `updatedAt: ${tableNameSingular}?.updatedAt ?? new Date(),
createdAt: ${tableNameSingular}?.createdAt ?? new Date(),`
? `updatedAt: ${tableNameSingular}?.updatedAt ?? new Date()${
config.driver === "sqlite"
? `.toISOString().slice(0, 19).replace("T", " ")`
: ""
},
createdAt: ${tableNameSingular}?.createdAt ?? new Date()${
config.driver === "sqlite"
? `.toISOString().slice(0, 19).replace("T", " ")`
: ""
},`
: ""
}
id: ${tableNameSingular}?.id ?? "",${
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { buildSchema } from "./commands/generate/index.js";
import { addPackage } from "./commands/add/index.js";

const program = new Command();
program.name("kirimase").description("Kirimase CLI").version("0.0.49");
program.name("kirimase").description("Kirimase CLI").version("0.0.50");

addCommonOptions(program.command("init"))
.description("initialise and configure kirimase within directory")
Expand Down

0 comments on commit a1331a9

Please sign in to comment.