-
Notifications
You must be signed in to change notification settings - Fork 1
feat: localisation time component, #185 #186
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks! 🙏
@@ -61,12 +69,12 @@ function getDateString({ | |||
const mins = parseInt(offset / ONE_MINUTE); | |||
dateString = minutesAgoReadout(mins); | |||
} | |||
// Occcured today... | |||
// Occured today... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Occured today... | |
// Occurred today... |
Sorry 😅
src/Time/getDateString.js
Outdated
@@ -16,10 +16,18 @@ function date(d) { | |||
|
|||
function getDateString({ | |||
dateTime, | |||
locale, | |||
locale = 'en-GB', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When new Intl.DateTimeFormat(locale, ...)
is defined with locale === undefined
it will imply the browser default language. Which for which ever language a user selects is still preferable IMO. Otherwise if we set a default, we then have to explicitly state the locale
everywhere we use it.
Could you use navigator.language
instead like...
locale = 'en-GB', | |
locale = navigator.language, |
I'm assuming navigator.language
is always going to be present and a string with a single locale reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Andrew!
🎉 This PR is included in version 14.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
fixes: #185
en-GB
hourCycle
to24
and only setshourCycle
to12
for locales where we want to displayAM
/PM
Screenshot: