MCPcopy Create free account
hub / github.com/UI5/webcomponents / _getFirstDay

Method _getFirstDay

packages/main/src/DayPicker.ts:935–955  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

933 }
934
935 _getFirstDay(): CalendarDate {
936 let daysFromPreviousMonth;
937
938 const firstDayOfWeek = this._getFirstDayOfWeek();
939
940 // determine weekday of first day in month
941 const firstDay = new CalendarDate(this._calendarDate, this._primaryCalendarType);
942 firstDay.setDate(1);
943
944 daysFromPreviousMonth = firstDay.getDay() - firstDayOfWeek;
945
946 if (daysFromPreviousMonth < 0) {
947 daysFromPreviousMonth = 7 + daysFromPreviousMonth;
948 }
949
950 if (daysFromPreviousMonth > 0) {
951 firstDay.setDate(1 - daysFromPreviousMonth);
952 }
953
954 return firstDay;
955 }
956
957 _getFirstDayOfWeek(): number {
958 const localeData = getCachedLocaleDataInstance(getLocale());

Callers 1

_buildWeeksMethod · 0.95

Calls 3

_getFirstDayOfWeekMethod · 0.95
setDateMethod · 0.95
getDayMethod · 0.95

Tested by

no test coverage detected