diff --git a/package.json b/package.json index c9ad977d..5807a1de 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/commands/generate/generators/views-with-server-actions.ts b/src/commands/generate/generators/views-with-server-actions.ts index 63419403..aa536283 100644 --- a/src/commands/generate/generators/views-with-server-actions.ts +++ b/src/commands/generate/generators/views-with-server-actions.ts @@ -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, @@ -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 ?? "",${ diff --git a/src/index.ts b/src/index.ts index e3f71bf8..3bfea671 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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")