Spec-Zone.ru › JavaScript

Intl.Locale.prototype.getWeekInfo()

Baseline Newly available

This feature works across the latest devices and browser versions. This feature might not work in older devices or browser versions. It's been available across browsers since July 2026.

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.

Syntax

getWeekInfo()

Parameters

None.

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 between 1 (Monday) and 7 (Sunday) indicating the first day of the week for the locale. Commonly 1, 5, 6, or 7.
weekend
An array of integers between 1 and 7 indicating the weekend days for the locale. This is usually continuous because UTS 35 stores weekendStart and weekendEnd instead.
minimalDays
An integer between 1 and 7 (commonly 1 and 4) indicating the minimal days required in the first week of a month or year, for week-of-year or week-of-month calculations (e.g., The 20th week of the year). For example, in the ISO 8601 calendar, the first week of a year must have at least 4 days in this year, so if January 1 is a Friday, Saturday, or Sunday, it will be numbered as part of the last week of the previous year.

Examples

Obtaining the Week Information

Return the week information for a given Locale.

const he = new Intl.Locale("he"); // Hebrew (Israel)
console.log(he.getWeekInfo()); // { firstDay: 7, weekend: [5, 6], minimalDays: 1 }

const af = new Intl.Locale("af"); // Afrikaans (South Africa)
console.log(af.getWeekInfo()); // { firstDay: 7, weekend: [6, 7], minimalDays: 1 }

const enGB = new Intl.Locale("en-GB"); // English (United Kingdom)
console.log(enGB.getWeekInfo()); // { firstDay: 1, weekend: [6, 7], minimalDays: 4 }

const arAF = new Intl.Locale("ar-AF"); // Arabic (Afghanistan)
console.log(arAF.getWeekInfo()); // { firstDay: 6, weekend: [4, 5], minimalDays: 1 }

const dvMV = new Intl.Locale("dv-MV"); // Divehi (Maldives)
console.log(dvMV.getWeekInfo()); // { firstDay: 5, weekend: [6, 7], minimalDays: 1 }

Specifications

Specification
Intl Locale Info Proposal
# sec-Intl.Locale.prototype.getWeekInfo

Browser compatibility

Desktop Mobile Server
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on iOS Samsung Internet WebView Android WebView on iOS Bun Deno Node.js
getWeekInfo
130
99Implemented as an accessor property.
130
99Implemented as an accessor property.
153
115
85Implemented as an accessor property.
17
15.4–previewImplemented as an accessor property.
130
99Implemented as an accessor property.
153
86
68Implemented as an accessor property.
17
15.4Implemented as an accessor property.
28.0
18.0Implemented as an accessor property.
130
99Implemented as an accessor property.
17
15.4Implemented as an accessor property.
1.0.0
2.1
1.19–2.6.7Implemented as an accessor property.
24.0.0
18.0.0Implemented as an accessor property.
returns_minimalDays_property
99–136
99–136
No
85–121
15.4
99–136
No
68–90
15.4
18.0–29.0
99–136
15.4
1.0.0
1.19
18.0.0–24.0.0

See also

  • Intl.Locale

© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API