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

Function dayOfMonth

packages/effect/src/internal/schedule.ts:518–544  ·  view source on GitHub ↗
(day: number)

Source from the content-addressed store, hash-verified

516
517/** @internal */
518export const dayOfMonth = (day: number): Schedule.Schedule<number> => {
519 return makeWithState<[number, number], unknown, number>(
520 [Number.NEGATIVE_INFINITY, 0],
521 (now, _, state) => {
522 if (!Number.isInteger(day) || day < 1 || 31 < day) {
523 return core.dieSync(() =>
524 new core.IllegalArgumentException(
525 `Invalid argument in: dayOfMonth(${day}). Must be in range 1...31`
526 )
527 )
528 }
529 const n = state[1]
530 const initial = n === 0
531 const day0 = nextDayOfMonth(now, day, initial)
532 const start = beginningOfDay(day0)
533 const end = endOfDay(day0)
534 const interval = Interval.make(start, end)
535 return core.succeed(
536 [
537 [end, n + 1],
538 n,
539 ScheduleDecision.continueWith(interval)
540 ]
541 )
542 }
543 )
544}
545
546/** @internal */
547export const dayOfWeek = (day: number): Schedule.Schedule<number> => {

Callers

nothing calls this directly

Calls 5

makeWithStateFunction · 0.85
nextDayOfMonthFunction · 0.85
beginningOfDayFunction · 0.85
endOfDayFunction · 0.85
makeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…