Intl.DurationFormat.prototype.resolvedOptions()
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Intl.DurationFormat 实例的 resolvedOptions() 方法返回一个新对象,其属性反映了在此 Intl.DurationFormat 对象初始化期间计算的区域设置以及日期和时间格式选项。
¥The resolvedOptions() method of Intl.DurationFormat instances returns a new object with properties reflecting the locale and date and time formatting options computed during initialization of this Intl.DurationFormat object.
语法
参数
返回值
¥Return value
一个新对象,其属性反映在给定 Intl.DateTimeFormat 对象初始化期间计算的区域设置以及日期和时间格式选项。
¥A new object with properties reflecting the locale and date and time formatting options computed during the initialization of the given Intl.DateTimeFormat object.
描述
¥Description
生成的对象具有以下属性:
¥The resulting object has the following properties:
locale-
所用区域设置的 BCP 47 语言标签。如果在导致此区域设置的输入 BCP 47 语言标记中请求了任何 Unicode 扩展值,则此区域设置所请求和支持的键值对将包含在
locale中。 style-
字符串
"long"、"short"、"narrow"或"digital"之一,标识所使用的持续时间格式样式。 years-
字符串
"long"、"short"或"narrow"之一,标识用于years字段的格式样式。 yearsDisplay-
字符串
"auto"或"always"之一,标识何时显示years字段。 months-
字符串
"long"、"short"、and "narrow"之一,标识用于months字段的格式样式。 monthsDisplay-
字符串
"auto"或"always"之一,标识何时显示months字段。 weeks-
字符串
"long"、"short"、and "narrow"之一,标识用于weeks字段的格式样式。 weeksDisplay-
字符串
"auto"或"always"之一,标识何时显示weeks字段。 days-
字符串
"long"、"short"和"narrow"之一,标识用于days字段的格式样式。 daysDisplay-
字符串
"auto"或"always"之一,标识何时显示days字段。 hours-
字符串
"long"、"short"、"narrow"、"2-digit"或"numeric"之一,标识用于hours字段的格式样式。 hoursDisplay-
字符串
"auto"或"always"之一,标识何时显示hours字段。 minutes-
字符串
"long"、"short"、"narrow"、"2-digit"或"numeric"之一,标识用于minutes字段的格式样式。 minutesDisplay-
字符串
"auto"或"always"之一,标识何时显示minutes字段。 seconds-
字符串
"long"、"short"、"narrow"、"2-digit"或"numeric"之一,标识用于seconds字段的格式样式。 secondsDisplay-
字符串
"auto"或"always"之一,标识何时显示seconds字段。 milliseconds-
字符串
"long"、"short"、"narrow"或"numeric"之一,标识用于milliseconds字段的格式样式。 millisecondsDisplay-
字符串
"auto"或"always"之一,标识何时显示millisecondsDisplay字段。 microseconds-
字符串
"long"、"short"、"narrow"或"numeric"之一,标识用于microseconds字段的格式样式。 microsecondsDisplay-
字符串
"auto"或"always"之一,标识何时显示microsecondsDisplay字段。 nanoseconds-
字符串
"long"、"short"、"narrow"或"numeric"之一,标识用于nanoseconds字段的格式样式。 nanosecondsDisplay-
字符串
"auto"或"always"之一,标识何时显示nanosecondsDisplay字段。 fractionalDigits-
一个数字,标识与数字样式一起使用的小数位数。
numberingSystem-
选项参数中为此属性提供的值(如果存在),或者使用 Unicode 扩展键
nu请求的值或作为默认值填写。
示例
使用 resolvedOptions 方法
规范
| Specification |
|---|
| Intl.DurationFormat # sec-Intl.DurationFormat.prototype.resolvedOptions |
浏览器兼容性
BCD tables only load in the browser
也可以看看
¥See also