MCPcopy Index your code
hub / github.com/Effect-TS/effect / clampBoundaryDay

Function clampBoundaryDay

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

Source from the content-addressed store, hash-verified

602 const currentMonth = current.getUTCMonth() + 1
603 const nextMonth = table.month[currentMonth]
604 const clampBoundaryDay = (targetMonthIndex: number): number => {
605 if (cron.days.size !== 0) {
606 return boundary.day
607 }
608 const maxDayInMonth = daysInMonth(new Date(Date.UTC(current.getUTCFullYear(), targetMonthIndex, 1)))
609 return Math.min(boundary.day, maxDayInMonth)
610 }
611 if (nextMonth === undefined) {
612 current.setUTCFullYear(current.getUTCFullYear() + tick)
613 current.setUTCMonth(boundary.month, clampBoundaryDay(boundary.month))

Callers 1

stepCronFunction · 0.85

Calls 1

daysInMonthFunction · 0.85

Tested by

no test coverage detected