Skip to content

Conversation

@rmtsrc
Copy link

@rmtsrc rmtsrc commented Oct 20, 2024

Different countries use different date formats, for example en-US: MM/DD/YYYY en-GB: DD/MM/YYYY.

Using dayjs().format('L HH:mm') only outputs using the en-US date format.

This PR changes the output to use the built in toLocaleDateString/toLocaleTimeString methods which will use the correct date format based on the users system locale settings:

Before (in en-GB):

Dates were in en-US format:
Screenshot from 2024-10-20 17-36-46

After (in en-GB):

Dates are in en-GB format:
Screenshot from 2024-10-20 17-54-44

@rmtsrc rmtsrc force-pushed the use-locale-datetime branch from 2562851 to 7d97b90 Compare February 1, 2025 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant