(date: Date, timeFormat: "12" | "24" = "24")
| 928 | * @returns Formatted time string |
| 929 | */ |
| 930 | export 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 |
no test coverage detected