@@ -13,11 +13,11 @@ examples):
1313var date = new JsDate (2020 , 11 , 20 , 3 , 23 , 16 , 738 );
1414
1515// Specify default date formatting for language (locale)
16- console. log(new DateTimeFormat (" en-US" ). format(date));
16+ console. log(dateTimeFormat (" en-US" ). format(date));
1717// Expected output: "12/20/2020"
1818
1919// Specify date and time format using "style" options (i.e. full, long, medium, short)
20- console. log(new DateTimeFormat (" en-GB" , DateTimeFormatOptions . create ()
20+ console. log(dateTimeFormat (" en-GB" , dateTimeFormatOptions ()
2121 .dateStyle(full)
2222 .timeStyle(full)
2323 .timeZone(" Australia/Sydney" )). format(date));
@@ -27,21 +27,21 @@ console.log(new DateTimeFormat("en-GB", DateTimeFormatOptions.create()
2727## Duration Formatting
2828
2929``` java
30- var duration = Duration . create ()
30+ var duration = duration ()
3131 .hours(1 )
3232 .minutes(46 )
3333 .seconds(40 );
3434
3535// With style set to "long" and locale "fr-FR"
36- new DurationFormat (" fr-FR" , DurationFormatOptions . create (). style(long_)). format(duration);
36+ durationFormat (" fr-FR" , durationFormatOptions (). style(long_)). format(duration);
3737// "1 heure, 46 minutes et 40 secondes"
3838
3939// With style set to "short" and locale "en"
40- new DurationFormat (" en" , DurationFormatOptions . create (). style(short_)). format(duration);
40+ durationFormat (" en" , durationFormatOptions (). style(short_)). format(duration);
4141// "1 hr, 46 min and 40 sec"
4242
4343// With style set to "narrow" and locale "pt"
44- new DurationFormat (" pt" , DurationFormatOptions . create (). style(narrow)). format(duration);
44+ durationFormat (" pt" , durationFormatOptions (). style(narrow)). format(duration);
4545// "1 h 46 min 40 s"
4646
4747```
@@ -51,19 +51,19 @@ new DurationFormat("pt", DurationFormatOptions.create().style(narrow)).format(du
5151``` java
5252var vehicles = JsArray . of(" Motorcycle" , " Bus" , " Car" );
5353
54- var formatter = new ListFormat (" en" , ListFormatOptions . create ()
54+ var formatter = listFormat (" en" , listFormatOptions ()
5555 .style(long_)
5656 .type(conjunction));
5757console. log(formatter. format(vehicles));
5858// Expected output: "Motorcycle, Bus, and Car"
5959
60- var formatter2 = new ListFormat (" de" , ListFormatOptions . create ()
60+ var formatter2 = listFormat (" de" , listFormatOptions ()
6161 .style(short_)
6262 .type(disjunction));
6363console. log(formatter2. format(vehicles));
6464// Expected output: "Motorcycle, Bus oder Car"
6565
66- var formatter3 = new ListFormat (" en" , ListFormatOptions . create ()
66+ var formatter3 = listFormat (" en" , listFormatOptions ()
6767 .style(narrow)
6868 .type(unit));
6969console. log(formatter3. format(vehicles));
@@ -74,21 +74,21 @@ console.log(formatter3.format(vehicles));
7474``` java
7575double number = 123456.789 ;
7676
77- console. log(new NumberFormat (" de-DE" , NumberFormatOptions . create ()
77+ console. log(numberFormat (" de-DE" , numberFormatOptions ()
7878 .style(currency)
7979 .currency(" EUR" ))
8080 .format(number));
8181// Expected output: "123.456,79 €"
8282
8383// The Japanese yen doesn't use a minor unit
84- console. log(new NumberFormat (" ja-JP" , NumberFormatOptions . create ()
84+ console. log(numberFormat (" ja-JP" , numberFormatOptions ()
8585 .style(currency)
8686 .currency(" JPY" ))
8787 .format(number));
8888// Expected output: "¥123,457"
8989
9090// Limit to three significant digits
91- console. log(new NumberFormat (" en-IN" , NumberFormatOptions . create ()
91+ console. log(numberFormat (" en-IN" , numberFormatOptions ()
9292 .maximumSignificantDigits(3 ))
9393 .format(number));
9494// Expected output: "1,23,000"
@@ -97,7 +97,7 @@ console.log(new NumberFormat("en-IN", NumberFormatOptions.create()
9797## Relative Time Formatting
9898
9999``` java
100- var rtf1 = new RelativeTimeFormat (" en" , RelativeTimeFormatOptions . create ()
100+ var rtf1 = relativeTimeFormat (" en" , relativeTimeFormatOptions ()
101101 .style(short_));
102102
103103console. log(rtf1. format(3 , " quarter" ));
@@ -106,7 +106,7 @@ console.log(rtf1.format(3, "quarter"));
106106console. log(rtf1. format(- 1 , " day" ));
107107// Expected output: "1 day ago"
108108
109- var rtf2 = new RelativeTimeFormat (" es" , RelativeTimeFormatOptions . create ()
109+ var rtf2 = relativeTimeFormat (" es" , relativeTimeFormatOptions ()
110110 .numeric(auto));
111111
112112console. log(rtf2. format(2 , " day" ));
0 commit comments