* Validate and format time string (HH:MM or HH:MM:SS format). * Returns the validated time in HH:MM:SS format, or the default value if invalid.
( value: string | undefined, defaultValue: string, maxHour = 23, allowMaxHourOnlyAtZero = false )
| 828 | * Returns the validated time in HH:MM:SS format, or the default value if invalid. |
| 829 | */ |
| 830 | private validateTimeValue( |
| 831 | value: string | undefined, |
| 832 | defaultValue: string, |
| 833 | maxHour = 23, |
| 834 | allowMaxHourOnlyAtZero = false |
| 835 | ): string { |
| 836 | const result = normalizeCalendarTimeValue(value, defaultValue, { |
| 837 | maxHour, |
| 838 | allowMaxHourOnlyAtZero, |
| 839 | }); |
| 840 | if (!result.isValid) { |
| 841 | tasknotesLogger.warn( |
| 842 | `[TaskNotes][CalendarView] Invalid time value: ${value}, using default: ${defaultValue}`, |
| 843 | { category: "provider", operation: "invalid-time-value" } |
| 844 | ); |
| 845 | } |
| 846 | return result.value; |
| 847 | } |
| 848 | |
| 849 | private getConfigOption<T>(key: string, fallback: T): T { |
| 850 | return getCalendarConfigValueFromSnapshot(this.config, key, fallback); |
no test coverage detected