MCPcopy
hub / github.com/callumalpass/tasknotes / validateTimeValue

Method validateTimeValue

src/bases/CalendarView.ts:830–847  ·  view source on GitHub ↗

* 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
	)

Source from the content-addressed store, hash-verified

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);

Callers 2

constructorMethod · 0.95
readViewOptionsMethod · 0.95

Calls 2

warnMethod · 0.80

Tested by

no test coverage detected