JavaScript

Intl.RelativeTimeFormat.prototype.resolvedOptions() メソッド


編集:2023.01.12 by T.A.

[Edge]。→

Intl.RelativeTimeFormat で、相対時間としての書式化で計算された新しい情報オブジェクトを返します。

構文
Intl.RelativeTimeFormat.resolvedOptions()
Intl.RelativeTimeFormat Intl.RelativeTimeFormat
戻り値

以下のプロパティを含むオブジェクト。

locale
文字列。→RelativeTimeFormat():locales

値例:「ja」

style
文字列。→RelativeTimeFormat():style

値例: 「long」

numeric
文字列。→RelativeTimeFormat():numeric

値例: 「always」

numberingSystem
文字列。→RelativeTimeFormat():numberingSystem

値例: 「latn」

DA=new Intl.RelativeTimeFormat('ja');  //日本語。
D=DA.resolvedOptions();  //=[object]:[object Object]
	//locale=[string]:ja
	//style=[string]:long
	//numeric=[string]:always
	//numberingSystem=[string]:latn
DA=new Intl.RelativeTimeFormat('ja-JP-u-nu-fullwide');  //日本語で日本国で数字は全角。
D=DA.resolvedOptions();  //=[object]:[object Object]
	//locale=[string]:ja-JP-u-nu-fullwide
	//style=[string]:long
	//numeric=[string]:always
	//numberingSystem=[string]:fullwide

RelativeTimeFormat()


テスト