Note |
---|
Please note that this document is a draft and still not finalized. |
...
Table of Contents | ||||
---|---|---|---|---|
|
What is Date and Time Localization?
Date and Time Localization of a website or a mobile app requires taking into account different formats for date and time. These formats vary, depending on your target country. To ensure that the users can easily understand the website or mobile app, it is important to show the content in their familiar date and time formatting styles.
Implementation of Date and Time Localization?
Use of Libraries
In software development, there are a numerous technologies, languages, and frameworks that we can use to implement date and time localization. Considering the nature of the project’s requirements, Moment.js has been selected for the implementation.
Moment.js
Moment.JS is a JavaScript library which helps is parsing, validating, manipulating and displaying date/time in JavaScript easily.
...
Browser support - Moment works well on Internet Explorer 8 and higher.
Dependency to other libraries - Several other libraries, especially date pickers and graphing libraries, take Moment as a dependency. If such a component is already used and cannot find an alternative, then Moment is already included in the project. Thus, it might make sense to continue using Moment throughout your project rather than including another date and time library.
Familiarity - Already understand its API and limitations well.
Date and Time localization related implementation
In the code level, we are parsing the ‘Locale’ to the moment.locale() function to detect the app specific locale and apply moment().format() function to configure the date and time formats.
...
Example : For Sweden, moment.lang("se").format('L');
Limitations
Here, the implementation doesn’t support the date localization based on the ‘Regions’. Only the basic language will be selected.
...