0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-06 22:10:10 -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: // Taken from:
// https://stackoverflow.com/questions/52869695/check-if-a-date-string-is-in-iso-and-utc-format // https://stackoverflow.com/questions/52869695/check-if-a-date-string-is-in-iso-and-utc-format
const isISODateString = (str: string) => const isISODateString = (str: string) => /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(str);
/\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 }>({ const dateType = customType<{ data: Date; driverData: string }>({
dataType() { dataType() {
@ -32,7 +31,7 @@ const dateType = customType<{ data: Date; driverData: string }>({
return value.toISOString(); return value.toISOString();
}, },
fromDriver(value) { fromDriver(value) {
if(!isISODateString(value)) { if (!isISODateString(value)) {
// values saved using CURRENT_TIMESTAMP are not valid ISO strings // values saved using CURRENT_TIMESTAMP are not valid ISO strings
// but *are* in UTC, so append the UTC zone. // but *are* in UTC, so append the UTC zone.
value += 'Z'; value += 'Z';