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

Function clampBoundaryDay

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

Source from the content-addressed store, hash-verified

635 const currentMonth = current.getUTCMonth() + 1
636 const nextMonth = table.month[currentMonth]
637 const clampBoundaryDay = (targetMonthIndex: number): number => {
638 if (cron.days.size !== 0 && cron.weekdays.size === 0) {
639 return boundary.day
640 }
641 const maxDayInMonth = daysInMonth(new Date(Date.UTC(current.getUTCFullYear(), targetMonthIndex, 1)))
642 return prev ? maxDayInMonth : 1
643 }
644 if (nextMonth === undefined) {
645 current.setUTCFullYear(current.getUTCFullYear() + tick)
646 current.setUTCMonth(boundary.month, clampBoundaryDay(boundary.month))

Callers 1

stepCronFunction · 0.85

Calls 1

daysInMonthFunction · 0.85

Tested by

no test coverage detected