(datetime: Date)
| 518 | * ISO Week starts on day 1 (Monday) and ends with day 0 (Sunday) |
| 519 | */ |
| 520 | export function getThursdayThisIsoWeek(datetime: Date) { |
| 521 | // getDay returns 0-6 range with sunday as 0. |
| 522 | const currentDay = datetime.getDay(); |
| 523 | |
| 524 | // On a Sunday, read the previous Thursday since ISO weeks start on Monday. |
| 525 | const deltaToThursday = currentDay === 0 ? -3 : THURSDAY - currentDay; |
| 526 | |
| 527 | return createDate( |
| 528 | datetime.getFullYear(), |
| 529 | datetime.getMonth(), |
| 530 | datetime.getDate() + deltaToThursday, |
| 531 | ); |
| 532 | } |
| 533 | |
| 534 | function weekGetter(size: number, monthBased = false): DateFormatter { |
| 535 | return function (date: Date, locale: string) { |
no test coverage detected
searching dependent graphs…