(hour: number)
| 832 | |
| 833 | /** @internal */ |
| 834 | export const hourOfDay = (hour: number): Schedule.Schedule<number> => |
| 835 | makeWithState<[number, number], unknown, number>( |
| 836 | [Number.NEGATIVE_INFINITY, 0], |
| 837 | (now, _, state) => { |
| 838 | if (!Number.isInteger(hour) || hour < 0 || 23 < hour) { |
| 839 | return core.dieSync(() => |
| 840 | new core.IllegalArgumentException( |
| 841 | `Invalid argument in: hourOfDay(${hour}). Must be in range 0...23` |
| 842 | ) |
| 843 | ) |
| 844 | } |
| 845 | const n = state[1] |
| 846 | const initial = n === 0 |
| 847 | const hour0 = nextHour(now, hour, initial) |
| 848 | const start = beginningOfHour(hour0) |
| 849 | const end = endOfHour(hour0) |
| 850 | const interval = Interval.make(start, end) |
| 851 | return core.succeed( |
| 852 | [ |
| 853 | [end, n + 1], |
| 854 | n, |
| 855 | ScheduleDecision.continueWith(interval) |
| 856 | ] |
| 857 | ) |
| 858 | } |
| 859 | ) |
| 860 | |
| 861 | /** @internal */ |
| 862 | export const identity = <A>(): Schedule.Schedule<A, A> => |
nothing calls this directly
no test coverage detected