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

Function formatDateTime

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

Source from the content-addressed store, hash-verified

947 * @returns Formatted date and time string
948 */
949export function formatDateTime(date: Date, timeFormat: "12" | "24" = "24"): string {
950 if (!isValid(date)) {
951 tasknotesLogger.warn("Invalid date provided to formatDateTime:", {
952 category: "validation",
953 operation: "invalid-date-provided-formatdatetime",
954 details: { value: date },
955 });
956 return "";
957 }
958
959 return format(date, timeFormat === "12" ? "MMM d, yyyy h:mm a" : "MMM d, yyyy HH:mm");
960}
961
962/**
963 * Format a date string with time in the user's preferred format

Callers 1

createTimeFormatHelperFunction · 0.70

Calls 1

warnMethod · 0.80

Tested by

no test coverage detected