Implement library to format time/dates for international users
See original GitHub issueIf you haven’t already, check out our contributing guidelines for onboarding!
Action Performed:
- Sign-in to e.cash desktop app or at https://expensify.cash
- Send a message to a contact
- The date and time on the message will be based on your current location and in US formatting (i.e., Perth Australia in the below example)
Expected Result:
- The time format and date format should fit the language and location of users all over the world.
- We want to create a definition for the date format 12/31/2020 for the US versus 31/12/2020 for the UK (for example).
- And create a definition for Friday, June 24 in the US, versus Freitag, 24. Juni in Germany (for example).
- The placement of the date and time stamp on the apps does not need to change - it just needs to be applicable to the location and language of the user.
As part of that, we need to implement a library to format dates.
The moment library handles most of this and we already have a DateUtils.js library. There’s 2 exposed methods right now:
timestampToRelative
: we can replace this with moment’sfromNow
method, it works practically the same as ours, but is locale aware.timestampToDateTime
: we can replace most of this method with moment’s calendar method that is locale aware. We can tweak the output to match exactly what we have by setting the calendar config- Add
locale
as the first param totimestampToRelative()
andtimestampToDateTime()
Any new method we want to expose, will be added there, always taking into consideration using .locale()
to set the locale.
Actual Result:
- At this time, the date format and language is based on US/English
Workaround:
- Continue using Expensify with the already provided date format.
Platform:
Where is this issue occurring?
Web - yes iOS - yes Android - yes Desktop App - yes Mobile Web - yes
Version Number: 1.0.2-11 (1.0.2-11) Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (19 by maintainers)
Top Results From Across the Web
Implement library to format time/dates for international users
As part of that, we need to implement a library to format dates. The moment library handles most of this and we already...
Read more >Globalize your date/time/number formats - Windows apps
Design your app to be global-ready by appropriately formatting dates, times, numbers, phone numbers, and currencies.
Read more >timeDate: Rmetrics - Chronological and Calendar Objects
NOTE: Rmetrics has implemented an automated date/time format identifier for many common date/time formats which tries to automatically recognise ...
Read more >Turning on international time and date formatting | Trello
Date formatting is changed per-language. For instance, English (US) and Français (Canada) will see a MM/DD/YYYY format.
Read more >Time and Dates (astropy.time) — Astropy v5.2
The usual way to use astropy.time is to create a Time object by supplying one or more input time values as well as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @iwiznia , based on our conversation, I have updated my proposal -
As stated the first param for both the functions will be the locale both of them can easily set the locale using moment’s
locale('<locale>')
method.I believe we have come to the consensus that we need the
calendar()
method but to lay it out simply we could stick to the default configuration if it works for us for now.Since we don’t want to populate our bundle by including all the locales, we can simply import the ones we feel will be used and that can work as a foundation towards adding more locales into our application.
Let me know if there is anything else.
Regards, Anup.
Closing this, looks like it was paid in Upwork months ago, reopen with comment if needed https://www.upwork.com/ab/c/8577561/contracts/26617789/#milestones%2F20210629%2F20210728
cc @Christinadobrzyn