Skip to content

anba/proposal-intl-datetime-style

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dateStyle and timeStyle option on Intl.DateTimeFormat API Specification [draft]

This proposal adds two options to Intl.DateTimeFormat: dateStyle and timeStyle. These options give a compact way to request the appropriate, locale-specific way to ask for a date and time of given lengths.

Status

Current Stage:

  • 🚀 Stage 3

Spec Text:

Authors

  • Zibi Braniecki (@zbraniecki)

Reviewers

  • ?

Informative

This proposal is based on the CLDR Date/Time Patterns:

Usage

let o = new Intl.DateTimeFormat("en" , {
  timeStyle: "short"
});
console.log(o.format(Date.now())); // "13:31"

let o = new Intl.DateTimeFormat("en" , {
  dateStyle: "short"
});
console.log(o.format(Date.now())); // "21.03.2012"

let o = new Intl.DateTimeFormat("en" , {
  timeStyle: "medium",
  dateStyle: "short"
});
console.log(o.format(Date.now())); // "21.03.2012, 13:31"

Render Spec

npm install
npm run build
open index.html

Backpointers

About

dateStyle and timeStyle options for DateTimeFormat

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 96.1%
  • Shell 3.9%