For one of the most common use cases, formatting dates, no libraries are required at all (except maybe a polyfill, depending what locales and environments you need to support). You can just use the Intl.DateTimeFormat constructor.
For example:
constdateFormat=(lang,country)=>{constformatter=newIntl.DateTimeFormat(`${lang}-${country}`,{dateStyle:'full'},)returndate=>formatter.format(newDate(date))}dateFormat('en','AU')(Date.now())// Friday, 18 September 2020dateFormat('th','TH')(Date.now())// วันศุกร์ที่ 18 กันยายน พ.ศ. 2563
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
For one of the most common use cases, formatting dates, no libraries are required at all (except maybe a polyfill, depending what locales and environments you need to support). You can just use the
Intl.DateTimeFormat
constructor.For example: