Fixed defaulting date in date formatter
This commit is contained in:
parent
9a0f32323e
commit
6b15848896
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.23.22",
|
"version": "0.23.23",
|
||||||
"description": "Utility library",
|
"description": "Utility library",
|
||||||
"author": "Zak Timson",
|
"author": "Zak Timson",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -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')}`;
|
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
|
// Handle timezones
|
||||||
let t!: [string, number];
|
let t!: [string, number];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user