在 Sails ORM/ODM Waterline 中有 3 种日期类型:date、time和datetime。在我的模型中,我有type:'date'
. 但是当我尝试像保存日期时YYYY-MM-DD
,它像YYYY-MM-(DD-1)T22:00:00Z
(UTC)一样保存它。数据库:postgreSQL
如何只保留日期,没有时间和时区转换?当然,我可以将其保留为string
类型。但在这种情况下,我将无法搜索范围内的日期。
更新 1:这是我模型的一部分。
id: {type: "Integer", autoIncrement: true, primaryKey: true},
name: {type: "string", required: true,},
description: {type: "text", required: false,},
type: {type: 'string'},
startDate: {type: "date",},
endDate: {type: "date",},
episodes: {type: "Integer", required: false,}
这是脚本“创建...”的内部
id serial NOT NULL,
name text,
description text,
type text,
"startDate" date,
"endDate" date,
episodes integer,
"createdAt" timestamp with time zone,
"updatedAt" timestamp with time zone,
我也不需要创建和更新字段(自动添加到每个表中),但这可能会在配置中禁用