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

Function formatTime

src/utils/dateUtils.ts:930–941  ·  view source on GitHub ↗
(date: Date, timeFormat: "12" | "24" = "24")

Source from the content-addressed store, hash-verified

928 * @returns Formatted time string
929 */
930export function formatTime(date: Date, timeFormat: "12" | "24" = "24"): string {
931 if (!isValid(date)) {
932 tasknotesLogger.warn("Invalid date provided to formatTime:", {
933 category: "validation",
934 operation: "invalid-date-provided-formattime",
935 details: { value: date },
936 });
937 return "";
938 }
939
940 return format(date, timeFormat === "12" ? "h:mm a" : "HH:mm");
941}
942
943/**
944 * Format a Date object with both date and time in the user's preferred format

Callers 4

updateSessionMetaMethod · 0.90
formatTimeRangeFunction · 0.90
formatDateStringTimeFunction · 0.70
createTimeFormatHelperFunction · 0.70

Calls 1

warnMethod · 0.80

Tested by

no test coverage detected