Fixed defaulting date in date formatter
All checks were successful
Build / Build NPM Project (push) Successful in 1m15s
Build / Tag Version (push) Successful in 16s
Build / Publish Documentation (push) Successful in 49s

This commit is contained in:
Zakary Timson 2025-04-30 11:58:03 -04:00
parent 9a0f32323e
commit 6b15848896
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@ztimson/utils",
"version": "0.23.22",
"version": "0.23.23",
"description": "Utility library",
"author": "Zak Timson",
"license": "MIT",

View File

@ -95,7 +95,7 @@ export function formatDate(format = 'YYYY-MM-DD H:mm', date: Date | number | str
return (offset > 0 ? '-' : '') + `${hours}:${minutes.toString().padStart(2, '0')}`;
}
if(typeof date == 'number' || typeof date == 'string') date = new Date(date);
if(typeof date == 'number' || typeof date == 'string' || date == null) date = new Date(date);
// Handle timezones
let t!: [string, number];