MCPcopy Create free account
hub / github.com/Effect-TS/effect / clampBoundaryDay

Function clampBoundaryDay

packages/effect/src/Cron.ts:968–974  ·  view source on GitHub ↗
(targetMonthIndex: number)

Source from the content-addressed store, hash-verified

966 const currentMonth = current.getUTCMonth() + 1
967 const nextMonth = table.month[currentMonth]
968 const clampBoundaryDay = (targetMonthIndex: number): number => {
969 const maxDayInMonth = daysInMonth(new Date(Date.UTC(current.getUTCFullYear(), targetMonthIndex + 1, 0)))
970 if (cron.days.size !== 0 && cron.weekdays.size === 0) {
971 return reverse ? table.day[maxDayInMonth] ?? maxDayInMonth : boundary.day
972 }
973 return reverse ? maxDayInMonth : 1
974 }
975 if (nextMonth === undefined) {
976 current.setUTCFullYear(current.getUTCFullYear() + tick)
977 current.setUTCMonth(boundary.month, clampBoundaryDay(boundary.month))

Callers 1

stepCronFunction · 0.85

Calls 1

daysInMonthFunction · 0.85

Tested by

no test coverage detected