diff --git a/package.json b/package.json index 57f5927..0d867de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ztimson/utils", - "version": "0.29.2", + "version": "0.29.3", "description": "Utility library", "author": "Zak Timson", "license": "MIT", diff --git a/src/time.ts b/src/time.ts index 8a03102..3e5f8dd 100644 --- a/src/time.ts +++ b/src/time.ts @@ -155,7 +155,7 @@ export function formatDate(format: string = 'YYYY-MM-DD H:mm', date: Date | numb }); const monthValue = parseInt(partsMap.month) - 1; - const dayOfWeekValue = new Date(`${partsMap.year}-${partsMap.month}-${partsMap.day}`).getDay(); + const dayOfWeekValue = new Date(Date.UTC(parseInt(partsMap.year), parseInt(partsMap.month) - 1, parseInt(partsMap.day))).getUTCDay(); const hourValue = parseInt(partsMap.hour); get = (fn: 'FullYear' | 'Month' | 'Date' | 'Day' | 'Hours' | 'Minutes' | 'Seconds' | 'Milliseconds'): number => {