[Edge]。→、
新しい Intl.RelativeTimeFormat オブジェクトを生成して返します。
| locales | 省略可。 言語タグを持つ文字列、またはそのような文字列の配列。→Intl:locales
¶以下の Unicode 拡張が使えるようです。 | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | 省略可。以下のプロパティと値を 1 組以上持つオブジェクト。
|
オブジェクト。
DA=new Intl.RelativeTimeFormat('ja'); //日本語。
D=DA.format(-1, 'day'); //-1で日付。
//=[string]:1 日前
DA=new Intl.RelativeTimeFormat('ja', {numeric:'auto'}); //日本語、数値:auto。
D=DA.format(-1, 'day'); //-1で日付。
//=[string]:昨日
DA=new Intl.RelativeTimeFormat('ja', {style:'short'}); //日本語、スタイル:短め。
D=DA.format(-1, 'day'); //-1で日付。
//=[string]:1 日前
DA=new Intl.RelativeTimeFormat('ja', {style:'narrow'}); //日本語、スタイル:超短め。
D=DA.format(-1, 'day'); //-1で日付。
//=[string]:1日前
DA=new Intl.RelativeTimeFormat('en', {style:'long'}); //英語、スタイル:長め。
D=DA.format(1, 'month'); //1で月。
//=[string]:in 1 month
DA=new Intl.RelativeTimeFormat('en', {style:'short'}); //英語、スタイル:短め。
D=DA.format(1, 'month'); //1で月。
//=[string]:in 1 mo.
DA=new Intl.RelativeTimeFormat('en', {style:'narrow'}); //英語、スタイル:超短め。
D=DA.format(1, 'month'); //1で月。
//=[string]:in 1 mo.
DA=new Intl.RelativeTimeFormat('ja-u-nu-hanidec'); //日本語、数値を漢字で
D=DA.format(-1, 'day'); //-1で日。
//=[string]:一 日前