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

Function getTimePart

src/utils/dateUtils.ts:905–922  ·  view source on GitHub ↗
(dateString: string)

Source from the content-addressed store, hash-verified

903 * Extract just the time part from a datetime string, returns null if no time
904 */
905export function getTimePart(dateString: string): string | null {
906 if (!dateString || !hasTimeComponent(dateString)) {
907 return null;
908 }
909
910 try {
911 const parsed = parseDateToLocalInternal(dateString);
912 return format(parsed, "HH:mm");
913 } catch (error) {
914 tasknotesLogger.error("Error extracting time part:", {
915 category: "validation",
916 operation: "extracting-time-part",
917 details: { dateString },
918 error: error,
919 });
920 return null;
921 }
922}
923
924/**
925 * Format a Date object with time in the user's preferred format (12h or 24h)

Calls 3

hasTimeComponentFunction · 0.85
parseDateToLocalInternalFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected