MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / parseTime

Function parseTime

src/utils/helpers.ts:213–233  ·  view source on GitHub ↗
(timeStr: string)

Source from the content-addressed store, hash-verified

211 * Parses a time string in the format HH:MM and returns hours and minutes
212 */
213export function parseTime(timeStr: string): TimeInfo | null {
214 try {
215 // Simple fallback parser
216 const match = timeStr.match(/^(\d{1,2}):(\d{2})$/);
217 if (match) {
218 const hours = parseInt(match[1], 10);
219 const minutes = parseInt(match[2], 10);
220 if (hours >= 0 && hours <= 23 && minutes >= 0 && minutes <= 59) {
221 return { hours, minutes };
222 }
223 }
224 return null;
225 } catch (error) {
226 tasknotesLogger.error("Error parsing time string:", {
227 category: "internal",
228 operation: "parsing-time-string",
229 error: error,
230 });
231 return null;
232 }
233}
234
235/**
236 * Calculate default date based on configuration option

Callers 1

helpers.test.tsFile · 0.90

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected