MCPcopy Index your code
hub / github.com/angular/angular / getThursdayThisIsoWeek

Function getThursdayThisIsoWeek

packages/common/src/i18n/format_date.ts:520–532  ·  view source on GitHub ↗
(datetime: Date)

Source from the content-addressed store, hash-verified

518 * ISO Week starts on day 1 (Monday) and ends with day 0 (Sunday)
519 */
520export 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
534function weekGetter(size: number, monthBased = false): DateFormatter {
535 return function (date: Date, locale: string) {

Callers 3

weekGetterFunction · 0.85
weekNumberingYearGetterFunction · 0.85

Calls 1

createDateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…