diff --git a/.vscode/settings.json b/.vscode/settings.json index 637cea4a..03182fcf 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -41,7 +41,8 @@ "WRHGZC", "wxyz", "zadd", - "zrange" + "zrange", + "datetime" ], "files.associations": { "*.css": "tailwindcss" diff --git a/src/utility/date.ts b/src/utility/date.ts index 04124327..9029c7b3 100644 --- a/src/utility/date.ts +++ b/src/utility/date.ts @@ -21,7 +21,7 @@ export const formatDateForPostgres = (date: Date) => const dateFromTimestamp = (timestamp?: AmbiguousTimestamp): Date => typeof timestamp === 'number' ? new Date(timestamp * 1000) - : typeof timestamp === 'string' + : typeof timestamp === 'string' && timestamp.trim().length > 0 ? /.+Z/i.test(timestamp) ? new Date(timestamp) : new Date(`${timestamp}Z`)