Intl.Locale.prototype.getWeekInfo()
The getWeekInfo()
method of Intl.Locale
instances returns a weekInfo
object with the properties firstDay
, weekend
and minimalDays
for this locale.
Note: In some versions of some browsers, this method was implemented as an accessor property called weekInfo
. However, because it returns a new object on each access, it is now implemented as a method to prevent the situation of locale.weekInfo === locale.weekInfo
returning false
. Check the browser compatibility table for details.
Return value
An object representing week information associated with the Locale data specified in UTS 35's Week Elements. It has the following properties:
-
firstDay
-
An integer indicating the first day of the week for the locale. Can be either 1
(Monday) or 7
(Sunday).
-
weekend
-
An array of integers indicating the weekend days for the locale, where 1
is Monday and 7
is Sunday.
-
minimalDays
-
An integer between 1 and 7 indicating the minimal days required in the first week of a month or year, for calendar purposes.
Return the week information for a given Locale
.
const he = new Intl.Locale("he");
console.log(he.getWeekInfo());
const af = new Intl.Locale("af");
console.log(af.getWeekInfo());
const enGB = new Intl.Locale("en-GB");
console.log(enGB.getWeekInfo());
const msBN = new Intl.Locale("ms-BN");
console.log(msBN.getWeekInfo());
Specifications
Browser compatibility
|
Desktop |
Mobile |
Server |
|
Chrome |
Edge |
Firefox |
Opera |
Safari |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
WebView Android |
Deno |
Node.js |
getWeekInfo |
99Implemented as an accessor property.
|
99Implemented as an accessor property.
|
No |
85Implemented as an accessor property.
|
17
15.4–previewImplemented as an accessor property.
|
99Implemented as an accessor property.
|
No |
68Implemented as an accessor property.
|
17
15.4Implemented as an accessor property.
|
18.0Implemented as an accessor property.
|
99Implemented as an accessor property.
|
1.19 |
18.0.0Implemented as an accessor property.
|