Skip to content

Commit

Permalink
making sure this works between midnight and 1am
Browse files Browse the repository at this point in the history
  • Loading branch information
catdad committed Jan 22, 2024
1 parent b3bf6ec commit b897bce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const isLocalhost = () => !!/^localhost:[0-9]+$/.test(location.host);

export const getDayName = (date, format = 'short') => date.toLocaleDateString(navigator.language, { weekday: format });
export const getDay = date => `${date.getFullYear()}-${date.toLocaleDateString(navigator.language, { month: '2-digit' })}-${date.toLocaleDateString(navigator.language, { day: '2-digit' })}`;
export const getDayWithHour = date => `${getDay(date)}T${date.toLocaleTimeString(navigator.language, { hour: '2-digit', hour12: false })}:00`;
export const getDayWithHour = date => `${getDay(date)}T${date.toLocaleTimeString(navigator.language, { hour: '2-digit', hourCycle: 'h23' })}:00`;
export const getDate = date => date.toLocaleDateString(navigator.language, { month: 'numeric', day: 'numeric' });
export const getDateTime = date => date.toLocaleString(navigator.language, { month: 'numeric', day: 'numeric', hour: 'numeric', minute: '2-digit', second: '2-digit' });
export const getTime = date => date.toLocaleTimeString(navigator.language, { hour: 'numeric', minute: 'numeric' });
Expand Down

0 comments on commit b897bce

Please sign in to comment.