(starterBlock: BlockState)
| 140 | * @returns Object with parsed time values |
| 141 | */ |
| 142 | export function getScheduleTimeValues(starterBlock: BlockState): { |
| 143 | scheduleTime: string |
| 144 | scheduleStartAt?: string |
| 145 | minutesInterval: number |
| 146 | hourlyMinute: number |
| 147 | dailyTime: [number, number] |
| 148 | weeklyDay: number |
| 149 | weeklyTime: [number, number] |
| 150 | monthlyDay: number |
| 151 | monthlyTime: [number, number] |
| 152 | cronExpression: string | null |
| 153 | timezone: string |
| 154 | } { |
| 155 | // Extract schedule time (common field that can override others) |
| 156 | const scheduleTime = getSubBlockValue(starterBlock, 'scheduleTime') |
| 157 | |
| 158 | // Extract schedule start date |
| 159 | const scheduleStartAt = getSubBlockValue(starterBlock, 'scheduleStartAt') |
| 160 | |
| 161 | // Extract timezone (default to UTC) |
| 162 | const timezone = getSubBlockValue(starterBlock, 'timezone') || 'UTC' |
| 163 | |
| 164 | // Get minutes interval (default to 15) |
| 165 | const minutesIntervalStr = getSubBlockValue(starterBlock, 'minutesInterval') |
| 166 | const minutesInterval = Number.parseInt(minutesIntervalStr) || 15 |
| 167 | |
| 168 | // Get hourly minute (default to 0) |
| 169 | const hourlyMinuteStr = getSubBlockValue(starterBlock, 'hourlyMinute') |
| 170 | const hourlyMinute = Number.parseInt(hourlyMinuteStr) || 0 |
| 171 | |
| 172 | // Get daily time |
| 173 | const dailyTime = parseTimeString(getSubBlockValue(starterBlock, 'dailyTime')) |
| 174 | |
| 175 | // Get weekly config |
| 176 | const weeklyDayStr = getSubBlockValue(starterBlock, 'weeklyDay') || 'MON' |
| 177 | const weeklyDay = DAY_MAP[weeklyDayStr] || 1 |
| 178 | const weeklyTime = parseTimeString(getSubBlockValue(starterBlock, 'weeklyDayTime')) |
| 179 | |
| 180 | // Get monthly config |
| 181 | const monthlyDayStr = getSubBlockValue(starterBlock, 'monthlyDay') |
| 182 | const monthlyDay = Number.parseInt(monthlyDayStr) || 1 |
| 183 | const monthlyTime = parseTimeString(getSubBlockValue(starterBlock, 'monthlyTime')) |
| 184 | |
| 185 | const cronExpression = getSubBlockValue(starterBlock, 'cronExpression') || null |
| 186 | |
| 187 | return { |
| 188 | scheduleTime, |
| 189 | scheduleStartAt, |
| 190 | timezone, |
| 191 | minutesInterval, |
| 192 | hourlyMinute, |
| 193 | dailyTime, |
| 194 | weeklyDay, |
| 195 | weeklyTime, |
| 196 | monthlyDay, |
| 197 | monthlyTime, |
| 198 | cronExpression, |
| 199 | } |
no test coverage detected