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