Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

294
Views
Differences in formatting using Intl.DateTimeFormat when including the script name

Wonder if anyone knows why when using Intl.DateTimeFormat to create a formatter using 'en-GB' as the locale will give a different output to using 'en-Latn-GB' but using 'zh-HK' and 'zh-Hant-HK' will give the same result.

See example below and JSFiddle

const date = new Date(Date.parse('2020-12-20T03:23:16'));


// Specify default date formatting for language (locale)
console.log(new Intl.DateTimeFormat('en-GB').format(date));
// expected output: "20/12/2020"
console.log(new Intl.DateTimeFormat('en-Latn-GB').format(date));
// expected output: "20/12/2020"

console.log(new Intl.DateTimeFormat('zh-HK').format(date));
// expected output: "20/12/2020"
console.log(new Intl.DateTimeFormat('zh-Hant-HK').format(date));
// expected output: "20/12/2020"

https://jsfiddle.net/aqn0e4tp/

The background to why we end up with 'en-Latn-GB' is for various reason we originally created a Intl.Locale for 'en-GB' and then called Locale.maximize() to default in some properties then after doing that using Locale.baseName as the locale when creating a formatter. In this situation Locale.baseName includes the script 'Latn'.

We can work around that issue but I am curious to know why there should be a difference.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!