0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[ci] format

This commit is contained in:
Matthew Phillips 2024-05-08 12:29:08 +00:00 committed by astrobot-houston
parent a1343184da
commit 8ef2f62c53

View file

@ -21,8 +21,7 @@ export function hasPrimaryKey(column: DBColumn) {
// Taken from:
// https://stackoverflow.com/questions/52869695/check-if-a-date-string-is-in-iso-and-utc-format
const isISODateString = (str: string) =>
/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(str);
const isISODateString = (str: string) => /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(str);
const dateType = customType<{ data: Date; driverData: string }>({
dataType() {
@ -32,7 +31,7 @@ const dateType = customType<{ data: Date; driverData: string }>({
return value.toISOString();
},
fromDriver(value) {
if(!isISODateString(value)) {
if (!isISODateString(value)) {
// values saved using CURRENT_TIMESTAMP are not valid ISO strings
// but *are* in UTC, so append the UTC zone.
value += 'Z';