scala-js/scala-js-dom

The `locales` parameter of `DateTimeFormat` and `NumberFormat` should be optional

Closed this issue · 0 comments

class DateTimeFormat(locales: String | js.Array[String],

MDN says:

Locale identification and negotiation

The locales argument must be either a string holding a BCP 47 language tag, or an array of such language tags. If the locales argument is not provided or is undefined, the runtime's default locale is used.

And

DateTimeFormat:

new Intl.DateTimeFormat([locales[, options]])
Intl.DateTimeFormat.call(this[, locales[, options]])

Current signature of DateTimeFormat and NumberFormat is:

class DateTimeFormat(locales: String | js.Array[String],

In comparison. for Collator it is:

class Collator(locales: js.UndefOr[String | js.Array[String]] = js.undefined,

I think the same locales parameter type should be used for DateTimeFormat and NumberFormat.