1 | var IntlPolyfill = require('./');
|
2 |
|
3 | console.log(new Intl.NumberFormat().format());
|
4 | console.log(new IntlPolyfill.NumberFormat('en', {}).format());
|
5 |
|
6 | console.log(new IntlPolyfill.DateTimeFormat('en-GB', {
|
7 | hour: '2-digit',
|
8 | hour12: false,
|
9 | minute: 'numeric'
|
10 | }).resolvedOptions());
|
11 | console.log(new IntlPolyfill.DateTimeFormat('en-GB', {
|
12 | hour: '2-digit',
|
13 | hour12: false,
|
14 | minute: 'numeric'
|
15 | }).format(new Date(1983, 9, 13)));
|
16 |
|
17 | var d = new Date('2015/04/05');
|
18 | var o = { hour: '2-digit', minute: '2-digit', timeZoneName: 'short' };
|
19 | var a = new Intl.DateTimeFormat('en-US', o).format(d);
|
20 | var b = new IntlPolyfill.DateTimeFormat('en-US', o).format(d);
|
21 | console.log('chrome : ', a);
|
22 | console.log('polyfill: ', b);
|
23 |
|
24 | var d = new Date('2015/04/05');
|
25 | var o = { year: '2-digit', month: '2-digit', day: '2-digit' };
|
26 | var a = new Intl.DateTimeFormat('en', o).format(d);
|
27 | var b = new IntlPolyfill.DateTimeFormat('en', o).format(d);
|
28 | console.log('chrome : ', a);
|
29 | console.log('polyfill: ', b);
|
30 |
|
31 |
|
32 | var o = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
|
33 | var a = new Intl.DateTimeFormat('ja-JP', o).format(d);
|
34 | var b = new IntlPolyfill.DateTimeFormat('ja-JP', o).format(d);
|
35 | console.log('chrome : ', a);
|
36 | console.log('polyfill: ', b);
|
37 |
|
38 |
|
39 | var a = new Intl.DateTimeFormat('en', {
|
40 | month: '2-digit'
|
41 | }).format(d);
|
42 | var b = new IntlPolyfill.DateTimeFormat('en', {
|
43 | month: '2-digit'
|
44 | }).format(d);
|
45 | console.log('chrome : ', a);
|
46 | console.log('polyfill: ', b);
|
47 |
|
48 |
|
49 | var o = {
|
50 | weekday: 'long'
|
51 | };
|
52 | var a = new Intl.DateTimeFormat('en-US', o).format(d);
|
53 | var b = new IntlPolyfill.DateTimeFormat('en-US', o).format(d);
|
54 | console.log('chrome : ', a);
|
55 | console.log('polyfill: ', b);
|
56 |
|
57 |
|
58 | var o = {
|
59 | month: 'long'
|
60 | };
|
61 | var a = new Intl.DateTimeFormat('en', o).format(d);
|
62 | var b = new IntlPolyfill.DateTimeFormat('en', o).format(d);
|
63 | console.log('chrome : ', a);
|
64 | console.log('polyfill: ', b);
|
65 |
|
66 | var o = {
|
67 | month: 'long',
|
68 | day: 'numeric'
|
69 | };
|
70 | var a = new Intl.DateTimeFormat('en', o).format(d);
|
71 | var b = new IntlPolyfill.DateTimeFormat('en', o).format(d);
|
72 | console.log('chrome : ', a);
|
73 | console.log('polyfill: ', b);
|
74 | console.log('ddddd');
|
75 |
|
76 | var d1 = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
|
77 | var o = { year: "numeric", month: "short", day: "numeric", weekday: "short" };
|
78 |
|
79 | var uu = new IntlPolyfill.DateTimeFormat('zh', o);
|
80 | var b = uu.format(d1);
|
81 | console.log('expected: 2012年12月19日星期三');
|
82 |
|
83 | console.log('polyfill: ', b);
|
84 |
|
85 |
|
86 |
|
87 | console.log('\nIssue #126:');
|
88 | var o = { month: 'long' };
|
89 | var a = new Intl.DateTimeFormat('ru', o).format(d);
|
90 | var b = new IntlPolyfill.DateTimeFormat('ru', o).format(d);
|
91 | console.log('chrome : ', a);
|
92 | console.log('polyfill: ', b);
|
93 | var o = { month: 'long', day: 'numeric' };
|
94 | var a = new Intl.DateTimeFormat('ru', o).format(d);
|
95 | var b = new IntlPolyfill.DateTimeFormat('ru', o).format(d);
|
96 | console.log('chrome : ', a);
|
97 | console.log('polyfill: ', b);
|