| 211 | * Parses a time string in the format HH:MM and returns hours and minutes |
| 212 | */ |
| 213 | export function parseTime(timeStr: string): TimeInfo | null { |
| 214 | try { |
| 215 | // Simple fallback parser |
| 216 | const match = timeStr.match(/^(\d{1,2}):(\d{2})$/); |
| 217 | if (match) { |
| 218 | const hours = parseInt(match[1], 10); |
| 219 | const minutes = parseInt(match[2], 10); |
| 220 | if (hours >= 0 && hours <= 23 && minutes >= 0 && minutes <= 59) { |
| 221 | return { hours, minutes }; |
| 222 | } |
| 223 | } |
| 224 | return null; |
| 225 | } catch (error) { |
| 226 | tasknotesLogger.error("Error parsing time string:", { |
| 227 | category: "internal", |
| 228 | operation: "parsing-time-string", |
| 229 | error: error, |
| 230 | }); |
| 231 | return null; |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * Calculate default date based on configuration option |