@@ -81,7 +81,7 @@ export function getBeginOfDecadeYear(date) {
81
81
* Returns the beginning of a given week.
82
82
*
83
83
* @param {Date } date Date.
84
- * @param {string } calendarType Calendar type.
84
+ * @param {string } [ calendarType="ISO 8601"] Calendar type.
85
85
*/
86
86
export function getBeginOfWeek ( date , calendarType = CALENDAR_TYPES . ISO_8601 ) {
87
87
const year = getYear ( date ) ;
@@ -96,7 +96,7 @@ export function getBeginOfWeek(date, calendarType = CALENDAR_TYPES.ISO_8601) {
96
96
* In US calendar week 1 is the one with January 1.
97
97
*
98
98
* @param {Date } date Date.
99
- * @param {string } calendarType Calendar type.
99
+ * @param {string } [ calendarType="ISO 8601"] Calendar type.
100
100
*/
101
101
export function getWeekNumber ( date , calendarType = CALENDAR_TYPES . ISO_8601 ) {
102
102
const calendarTypeForWeekNumber =
@@ -289,12 +289,19 @@ function toYearLabel(locale, formatYear = defaultFormatYear, dates) {
289
289
return dates . map ( ( date ) => formatYear ( locale , date ) ) . join ( ' – ' ) ;
290
290
}
291
291
292
+ /**
293
+ * @callback FormatYear
294
+ * @param {string } locale Locale.
295
+ * @param {Date } date Date.
296
+ * @returns {string } Formatted year.
297
+ */
298
+
292
299
/**
293
300
* Returns a string labelling a century of a given date.
294
301
* For example, for 2017 it will return 2001-2100.
295
302
*
296
303
* @param {string } locale Locale.
297
- * @param {function } formatYear Function to format a year.
304
+ * @param {FormatYear } formatYear Function to format a year.
298
305
* @param {Date|string|number } date Date or a year as a string or as a number.
299
306
*/
300
307
export function getCenturyLabel ( locale , formatYear , date ) {
@@ -306,7 +313,7 @@ export function getCenturyLabel(locale, formatYear, date) {
306
313
* For example, for 2017 it will return 2011-2020.
307
314
*
308
315
* @param {string } locale Locale.
309
- * @param {function } formatYear Function to format a year.
316
+ * @param {FormatYear } formatYear Function to format a year.
310
317
* @param {Date|string|number } date Date or a year as a string or as a number.
311
318
*/
312
319
export function getDecadeLabel ( locale , formatYear , date ) {
@@ -326,7 +333,7 @@ export function isCurrentDayOfWeek(date) {
326
333
* Returns a boolean determining whether a given date is a weekend day.
327
334
*
328
335
* @param {Date } date Date.
329
- * @param {string } calendarType Calendar type.
336
+ * @param {string } [ calendarType="ISO 8601"] Calendar type.
330
337
*/
331
338
export function isWeekend ( date , calendarType = CALENDAR_TYPES . ISO_8601 ) {
332
339
const weekday = date . getDay ( ) ;
0 commit comments