@mrck-labs/vanaheim-shared 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -320,5 +320,154 @@ interface ExchangeRate {
320
320
  rateToCHF: number;
321
321
  updatedAt: string;
322
322
  }
323
+ interface DailyPriority {
324
+ id: string;
325
+ title: string;
326
+ completed: boolean;
327
+ order: number;
328
+ }
329
+ interface DailyPlan {
330
+ id: string;
331
+ userId: string;
332
+ date: string;
333
+ priorities: string;
334
+ reflection: string | null;
335
+ energyLevel: number | null;
336
+ createdAt: string;
337
+ updatedAt: string;
338
+ }
339
+ interface NewDailyPlan {
340
+ date: string;
341
+ priorities?: string;
342
+ reflection?: string | null;
343
+ energyLevel?: number | null;
344
+ }
345
+ interface ParsedDailyPlan extends Omit<DailyPlan, 'priorities'> {
346
+ priorities: DailyPriority[];
347
+ }
348
+ type MealType = 'breakfast' | 'lunch' | 'dinner' | 'snack';
349
+ interface MealPlan {
350
+ id: string;
351
+ userId: string;
352
+ date: string;
353
+ mealType: MealType;
354
+ recipeId: string | null;
355
+ ingredientId: string | null;
356
+ customMeal: string | null;
357
+ servings: number;
358
+ notes: string | null;
359
+ isCompleted: boolean;
360
+ createdAt: string;
361
+ updatedAt: string;
362
+ }
363
+ interface NewMealPlan {
364
+ date: string;
365
+ mealType: MealType;
366
+ recipeId?: string | null;
367
+ ingredientId?: string | null;
368
+ customMeal?: string | null;
369
+ servings?: number;
370
+ notes?: string | null;
371
+ isCompleted?: boolean;
372
+ }
373
+ interface PrepSession {
374
+ id: string;
375
+ userId: string;
376
+ scheduledDate: string;
377
+ scheduledTime: string | null;
378
+ durationMinutes: number | null;
379
+ title: string;
380
+ description: string | null;
381
+ linkedMealIds: string | null;
382
+ isCompleted: boolean;
383
+ createdAt: string;
384
+ updatedAt: string;
385
+ }
386
+ interface NewPrepSession {
387
+ scheduledDate: string;
388
+ scheduledTime?: string | null;
389
+ durationMinutes?: number | null;
390
+ title: string;
391
+ description?: string | null;
392
+ linkedMealIds?: string | null;
393
+ isCompleted?: boolean;
394
+ }
395
+ interface FocusArea {
396
+ area: string;
397
+ goal: string;
398
+ }
399
+ interface WeeklyPlan {
400
+ id: string;
401
+ userId: string;
402
+ weekStart: string;
403
+ reviewNotes: string | null;
404
+ lastWeekRating: number | null;
405
+ focusAreas: string | null;
406
+ weeklyIntention: string | null;
407
+ createdAt: string;
408
+ updatedAt: string;
409
+ }
410
+ interface NewWeeklyPlan {
411
+ weekStart: string;
412
+ reviewNotes?: string | null;
413
+ lastWeekRating?: number | null;
414
+ focusAreas?: string | null;
415
+ weeklyIntention?: string | null;
416
+ }
417
+ interface ParsedWeeklyPlan extends Omit<WeeklyPlan, 'focusAreas'> {
418
+ focusAreas: FocusArea[];
419
+ }
420
+ type NoteType = 'native' | 'craft' | 'github' | 'notion' | 'link';
421
+ interface NoteFolder {
422
+ id: string;
423
+ userId: string;
424
+ name: string;
425
+ icon: string | null;
426
+ color: string | null;
427
+ parentId: string | null;
428
+ sortOrder: number;
429
+ createdAt: string;
430
+ updatedAt: string;
431
+ }
432
+ interface NewNoteFolder {
433
+ name: string;
434
+ icon?: string | null;
435
+ color?: string | null;
436
+ parentId?: string | null;
437
+ sortOrder?: number;
438
+ }
439
+ interface Note {
440
+ id: string;
441
+ userId: string;
442
+ folderId: string | null;
443
+ title: string;
444
+ noteType: NoteType;
445
+ content: string | null;
446
+ externalUrl: string | null;
447
+ externalService: string | null;
448
+ icon: string | null;
449
+ tags: string | null;
450
+ isPinned: boolean;
451
+ lastAccessedAt: string | null;
452
+ createdAt: string;
453
+ updatedAt: string;
454
+ }
455
+ interface NewNote {
456
+ folderId?: string | null;
457
+ title: string;
458
+ noteType: NoteType;
459
+ content?: string | null;
460
+ externalUrl?: string | null;
461
+ externalService?: string | null;
462
+ icon?: string | null;
463
+ tags?: string | null;
464
+ isPinned?: boolean;
465
+ }
466
+ interface NoteFilters {
467
+ folderId?: string;
468
+ noteType?: NoteType;
469
+ isPinned?: boolean;
470
+ search?: string;
471
+ }
323
472
 
324
- export type { NewHealthCompletion as A, BankConnectionStatus as B, ChatMessageRole as C, HealthHabitFilters as D, ExpenseCategory as E, FocusCategory as F, HealthCompletionFilters as G, HealthCategory as H, IncomeCategory as I, HealthStats as J, ExchangeRate as K, LieuDayType as L, NewExpenseCategory as N, Setting as S, TransactionType as T, Expense as a, NewExpense as b, NewIncomeCategory as c, Income as d, NewIncome as e, NewFocusCategory as f, FocusSessionStatus as g, FocusSession as h, NewFocusSession as i, FocusSessionFilters as j, ChatConversation as k, NewChatConversation as l, ChatMessage as m, NewChatMessage as n, EFLink as o, NewEFLink as p, LieuDay as q, NewLieuDay as r, BankConnection as s, BankTransaction as t, NewHealthCategory as u, HealthFrequencyType as v, HealthFrequencyConfig as w, HealthHabit as x, NewHealthHabit as y, HealthCompletion as z };
473
+ export type { ParsedWeeklyPlan as $, NewHealthCompletion as A, BankConnectionStatus as B, ChatMessageRole as C, HealthHabitFilters as D, ExpenseCategory as E, FocusCategory as F, HealthCompletionFilters as G, HealthCategory as H, IncomeCategory as I, HealthStats as J, ExchangeRate as K, LieuDayType as L, DailyPriority as M, NewExpenseCategory as N, DailyPlan as O, NewDailyPlan as P, ParsedDailyPlan as Q, MealType as R, Setting as S, TransactionType as T, MealPlan as U, NewMealPlan as V, PrepSession as W, NewPrepSession as X, FocusArea as Y, WeeklyPlan as Z, NewWeeklyPlan as _, Expense as a, NoteType as a0, NoteFolder as a1, NewNoteFolder as a2, Note as a3, NewNote as a4, NoteFilters as a5, NewExpense as b, NewIncomeCategory as c, Income as d, NewIncome as e, NewFocusCategory as f, FocusSessionStatus as g, FocusSession as h, NewFocusSession as i, FocusSessionFilters as j, ChatConversation as k, NewChatConversation as l, ChatMessage as m, NewChatMessage as n, EFLink as o, NewEFLink as p, LieuDay as q, NewLieuDay as r, BankConnection as s, BankTransaction as t, NewHealthCategory as u, HealthFrequencyType as v, HealthFrequencyConfig as w, HealthHabit as x, NewHealthHabit as y, HealthCompletion as z };
@@ -320,5 +320,154 @@ interface ExchangeRate {
320
320
  rateToCHF: number;
321
321
  updatedAt: string;
322
322
  }
323
+ interface DailyPriority {
324
+ id: string;
325
+ title: string;
326
+ completed: boolean;
327
+ order: number;
328
+ }
329
+ interface DailyPlan {
330
+ id: string;
331
+ userId: string;
332
+ date: string;
333
+ priorities: string;
334
+ reflection: string | null;
335
+ energyLevel: number | null;
336
+ createdAt: string;
337
+ updatedAt: string;
338
+ }
339
+ interface NewDailyPlan {
340
+ date: string;
341
+ priorities?: string;
342
+ reflection?: string | null;
343
+ energyLevel?: number | null;
344
+ }
345
+ interface ParsedDailyPlan extends Omit<DailyPlan, 'priorities'> {
346
+ priorities: DailyPriority[];
347
+ }
348
+ type MealType = 'breakfast' | 'lunch' | 'dinner' | 'snack';
349
+ interface MealPlan {
350
+ id: string;
351
+ userId: string;
352
+ date: string;
353
+ mealType: MealType;
354
+ recipeId: string | null;
355
+ ingredientId: string | null;
356
+ customMeal: string | null;
357
+ servings: number;
358
+ notes: string | null;
359
+ isCompleted: boolean;
360
+ createdAt: string;
361
+ updatedAt: string;
362
+ }
363
+ interface NewMealPlan {
364
+ date: string;
365
+ mealType: MealType;
366
+ recipeId?: string | null;
367
+ ingredientId?: string | null;
368
+ customMeal?: string | null;
369
+ servings?: number;
370
+ notes?: string | null;
371
+ isCompleted?: boolean;
372
+ }
373
+ interface PrepSession {
374
+ id: string;
375
+ userId: string;
376
+ scheduledDate: string;
377
+ scheduledTime: string | null;
378
+ durationMinutes: number | null;
379
+ title: string;
380
+ description: string | null;
381
+ linkedMealIds: string | null;
382
+ isCompleted: boolean;
383
+ createdAt: string;
384
+ updatedAt: string;
385
+ }
386
+ interface NewPrepSession {
387
+ scheduledDate: string;
388
+ scheduledTime?: string | null;
389
+ durationMinutes?: number | null;
390
+ title: string;
391
+ description?: string | null;
392
+ linkedMealIds?: string | null;
393
+ isCompleted?: boolean;
394
+ }
395
+ interface FocusArea {
396
+ area: string;
397
+ goal: string;
398
+ }
399
+ interface WeeklyPlan {
400
+ id: string;
401
+ userId: string;
402
+ weekStart: string;
403
+ reviewNotes: string | null;
404
+ lastWeekRating: number | null;
405
+ focusAreas: string | null;
406
+ weeklyIntention: string | null;
407
+ createdAt: string;
408
+ updatedAt: string;
409
+ }
410
+ interface NewWeeklyPlan {
411
+ weekStart: string;
412
+ reviewNotes?: string | null;
413
+ lastWeekRating?: number | null;
414
+ focusAreas?: string | null;
415
+ weeklyIntention?: string | null;
416
+ }
417
+ interface ParsedWeeklyPlan extends Omit<WeeklyPlan, 'focusAreas'> {
418
+ focusAreas: FocusArea[];
419
+ }
420
+ type NoteType = 'native' | 'craft' | 'github' | 'notion' | 'link';
421
+ interface NoteFolder {
422
+ id: string;
423
+ userId: string;
424
+ name: string;
425
+ icon: string | null;
426
+ color: string | null;
427
+ parentId: string | null;
428
+ sortOrder: number;
429
+ createdAt: string;
430
+ updatedAt: string;
431
+ }
432
+ interface NewNoteFolder {
433
+ name: string;
434
+ icon?: string | null;
435
+ color?: string | null;
436
+ parentId?: string | null;
437
+ sortOrder?: number;
438
+ }
439
+ interface Note {
440
+ id: string;
441
+ userId: string;
442
+ folderId: string | null;
443
+ title: string;
444
+ noteType: NoteType;
445
+ content: string | null;
446
+ externalUrl: string | null;
447
+ externalService: string | null;
448
+ icon: string | null;
449
+ tags: string | null;
450
+ isPinned: boolean;
451
+ lastAccessedAt: string | null;
452
+ createdAt: string;
453
+ updatedAt: string;
454
+ }
455
+ interface NewNote {
456
+ folderId?: string | null;
457
+ title: string;
458
+ noteType: NoteType;
459
+ content?: string | null;
460
+ externalUrl?: string | null;
461
+ externalService?: string | null;
462
+ icon?: string | null;
463
+ tags?: string | null;
464
+ isPinned?: boolean;
465
+ }
466
+ interface NoteFilters {
467
+ folderId?: string;
468
+ noteType?: NoteType;
469
+ isPinned?: boolean;
470
+ search?: string;
471
+ }
323
472
 
324
- export type { NewHealthCompletion as A, BankConnectionStatus as B, ChatMessageRole as C, HealthHabitFilters as D, ExpenseCategory as E, FocusCategory as F, HealthCompletionFilters as G, HealthCategory as H, IncomeCategory as I, HealthStats as J, ExchangeRate as K, LieuDayType as L, NewExpenseCategory as N, Setting as S, TransactionType as T, Expense as a, NewExpense as b, NewIncomeCategory as c, Income as d, NewIncome as e, NewFocusCategory as f, FocusSessionStatus as g, FocusSession as h, NewFocusSession as i, FocusSessionFilters as j, ChatConversation as k, NewChatConversation as l, ChatMessage as m, NewChatMessage as n, EFLink as o, NewEFLink as p, LieuDay as q, NewLieuDay as r, BankConnection as s, BankTransaction as t, NewHealthCategory as u, HealthFrequencyType as v, HealthFrequencyConfig as w, HealthHabit as x, NewHealthHabit as y, HealthCompletion as z };
473
+ export type { ParsedWeeklyPlan as $, NewHealthCompletion as A, BankConnectionStatus as B, ChatMessageRole as C, HealthHabitFilters as D, ExpenseCategory as E, FocusCategory as F, HealthCompletionFilters as G, HealthCategory as H, IncomeCategory as I, HealthStats as J, ExchangeRate as K, LieuDayType as L, DailyPriority as M, NewExpenseCategory as N, DailyPlan as O, NewDailyPlan as P, ParsedDailyPlan as Q, MealType as R, Setting as S, TransactionType as T, MealPlan as U, NewMealPlan as V, PrepSession as W, NewPrepSession as X, FocusArea as Y, WeeklyPlan as Z, NewWeeklyPlan as _, Expense as a, NoteType as a0, NoteFolder as a1, NewNoteFolder as a2, Note as a3, NewNote as a4, NoteFilters as a5, NewExpense as b, NewIncomeCategory as c, Income as d, NewIncome as e, NewFocusCategory as f, FocusSessionStatus as g, FocusSession as h, NewFocusSession as i, FocusSessionFilters as j, ChatConversation as k, NewChatConversation as l, ChatMessage as m, NewChatMessage as n, EFLink as o, NewEFLink as p, LieuDay as q, NewLieuDay as r, BankConnection as s, BankTransaction as t, NewHealthCategory as u, HealthFrequencyType as v, HealthFrequencyConfig as w, HealthHabit as x, NewHealthHabit as y, HealthCompletion as z };
@@ -129,6 +129,16 @@ declare function formatMonthYear(date: Date): string;
129
129
  * Note: For formatting seconds (e.g., timer display), use formatTime from utils
130
130
  */
131
131
  declare function formatTimeHHMM(date: Date | string): string;
132
+ /**
133
+ * Format time in short format (12h without seconds)
134
+ * @example formatTimeShort(new Date()) => "2:30 PM"
135
+ */
136
+ declare function formatTimeShort(date: Date | string): string;
137
+ /**
138
+ * Format a Date object for display in readable format
139
+ * @example formatDateDisplay(new Date()) => "Monday, Dec 22"
140
+ */
141
+ declare function formatDateDisplay(date: Date): string;
132
142
  /**
133
143
  * Format a date/time to HH:MM:SS format
134
144
  */
@@ -177,4 +187,4 @@ declare function formatDateLocalized(date: Date | string, format?: DateFormat):
177
187
  */
178
188
  declare function formatTimeLocalized(date: Date | string, format?: TimeFormat): string;
179
189
 
180
- export { type DateFormat, type TimeFormat, addDays, formatDateHeader, formatDateLocalized, formatDateLong, formatDateString, formatDueDateString, formatFullDate, formatMonthYear, formatRelativeDueDate, formatRelativePayDate, formatRelativeTimeExtended, formatTimeHHMM, formatTimeLocalized, formatTimeWithSeconds, formatWeekRange, getEndOfDayISO, getNextWeek, getPreviousWeek, getStartOfDayISO, getTodayMidnight, getTodayString, getTomorrowString, getWeekEnd, getWeekEndString, getWeekStart, getWeekStartString, getYesterdayString, isDueSoon, isOverdue, isToday, normalizeToMidnight, parseLocalDate, subtractDays };
190
+ export { type DateFormat, type TimeFormat, addDays, formatDateDisplay, formatDateHeader, formatDateLocalized, formatDateLong, formatDateString, formatDueDateString, formatFullDate, formatMonthYear, formatRelativeDueDate, formatRelativePayDate, formatRelativeTimeExtended, formatTimeHHMM, formatTimeLocalized, formatTimeShort, formatTimeWithSeconds, formatWeekRange, getEndOfDayISO, getNextWeek, getPreviousWeek, getStartOfDayISO, getTodayMidnight, getTodayString, getTomorrowString, getWeekEnd, getWeekEndString, getWeekStart, getWeekStartString, getYesterdayString, isDueSoon, isOverdue, isToday, normalizeToMidnight, parseLocalDate, subtractDays };
@@ -129,6 +129,16 @@ declare function formatMonthYear(date: Date): string;
129
129
  * Note: For formatting seconds (e.g., timer display), use formatTime from utils
130
130
  */
131
131
  declare function formatTimeHHMM(date: Date | string): string;
132
+ /**
133
+ * Format time in short format (12h without seconds)
134
+ * @example formatTimeShort(new Date()) => "2:30 PM"
135
+ */
136
+ declare function formatTimeShort(date: Date | string): string;
137
+ /**
138
+ * Format a Date object for display in readable format
139
+ * @example formatDateDisplay(new Date()) => "Monday, Dec 22"
140
+ */
141
+ declare function formatDateDisplay(date: Date): string;
132
142
  /**
133
143
  * Format a date/time to HH:MM:SS format
134
144
  */
@@ -177,4 +187,4 @@ declare function formatDateLocalized(date: Date | string, format?: DateFormat):
177
187
  */
178
188
  declare function formatTimeLocalized(date: Date | string, format?: TimeFormat): string;
179
189
 
180
- export { type DateFormat, type TimeFormat, addDays, formatDateHeader, formatDateLocalized, formatDateLong, formatDateString, formatDueDateString, formatFullDate, formatMonthYear, formatRelativeDueDate, formatRelativePayDate, formatRelativeTimeExtended, formatTimeHHMM, formatTimeLocalized, formatTimeWithSeconds, formatWeekRange, getEndOfDayISO, getNextWeek, getPreviousWeek, getStartOfDayISO, getTodayMidnight, getTodayString, getTomorrowString, getWeekEnd, getWeekEndString, getWeekStart, getWeekStartString, getYesterdayString, isDueSoon, isOverdue, isToday, normalizeToMidnight, parseLocalDate, subtractDays };
190
+ export { type DateFormat, type TimeFormat, addDays, formatDateDisplay, formatDateHeader, formatDateLocalized, formatDateLong, formatDateString, formatDueDateString, formatFullDate, formatMonthYear, formatRelativeDueDate, formatRelativePayDate, formatRelativeTimeExtended, formatTimeHHMM, formatTimeLocalized, formatTimeShort, formatTimeWithSeconds, formatWeekRange, getEndOfDayISO, getNextWeek, getPreviousWeek, getStartOfDayISO, getTodayMidnight, getTodayString, getTomorrowString, getWeekEnd, getWeekEndString, getWeekStart, getWeekStartString, getYesterdayString, isDueSoon, isOverdue, isToday, normalizeToMidnight, parseLocalDate, subtractDays };
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var date_exports = {};
22
22
  __export(date_exports, {
23
23
  addDays: () => addDays,
24
+ formatDateDisplay: () => formatDateDisplay,
24
25
  formatDateHeader: () => formatDateHeader,
25
26
  formatDateLocalized: () => formatDateLocalized,
26
27
  formatDateLong: () => formatDateLong,
@@ -33,6 +34,7 @@ __export(date_exports, {
33
34
  formatRelativeTimeExtended: () => formatRelativeTimeExtended,
34
35
  formatTimeHHMM: () => formatTimeHHMM,
35
36
  formatTimeLocalized: () => formatTimeLocalized,
37
+ formatTimeShort: () => formatTimeShort,
36
38
  formatTimeWithSeconds: () => formatTimeWithSeconds,
37
39
  formatWeekRange: () => formatWeekRange,
38
40
  getEndOfDayISO: () => getEndOfDayISO,
@@ -184,6 +186,17 @@ function formatTimeHHMM(date) {
184
186
  const d = typeof date === "string" ? new Date(date) : date;
185
187
  return d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
186
188
  }
189
+ function formatTimeShort(date) {
190
+ const d = typeof date === "string" ? new Date(date) : date;
191
+ return d.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
192
+ }
193
+ function formatDateDisplay(date) {
194
+ return date.toLocaleDateString("en-US", {
195
+ weekday: "long",
196
+ month: "short",
197
+ day: "numeric"
198
+ });
199
+ }
187
200
  function formatTimeWithSeconds(date) {
188
201
  const d = typeof date === "string" ? new Date(date) : date;
189
202
  return d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", second: "2-digit" });
@@ -311,6 +324,7 @@ function formatTimeLocalized(date, format = "short") {
311
324
  // Annotate the CommonJS export names for ESM import in node:
312
325
  0 && (module.exports = {
313
326
  addDays,
327
+ formatDateDisplay,
314
328
  formatDateHeader,
315
329
  formatDateLocalized,
316
330
  formatDateLong,
@@ -323,6 +337,7 @@ function formatTimeLocalized(date, format = "short") {
323
337
  formatRelativeTimeExtended,
324
338
  formatTimeHHMM,
325
339
  formatTimeLocalized,
340
+ formatTimeShort,
326
341
  formatTimeWithSeconds,
327
342
  formatWeekRange,
328
343
  getEndOfDayISO,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/date/index.ts"],"sourcesContent":["/**\n * Date Utilities\n *\n * Pure functions for date manipulation and formatting.\n * Works in both Node.js and browser/React Native environments.\n *\n * @example\n * import { getTodayString, addDays, formatRelativeTime } from '@mrck-labs/vanaheim-shared/date'\n *\n * const today = getTodayString() // \"2024-12-16\"\n * const nextWeek = addDays(today, 7) // \"2024-12-23\"\n */\n\n// ============================================================================\n// Core Utilities\n// ============================================================================\n\n/**\n * Normalize a date to midnight (00:00:00.000)\n */\nexport function normalizeToMidnight(date: Date): Date {\n const d = new Date(date)\n d.setHours(0, 0, 0, 0)\n return d\n}\n\n/**\n * Get today's date normalized to midnight\n */\nexport function getTodayMidnight(): Date {\n return normalizeToMidnight(new Date())\n}\n\n/**\n * Format a Date object to YYYY-MM-DD string\n * @example formatDateString(new Date()) => \"2024-12-16\"\n */\nexport function formatDateString(date: Date): string {\n return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`\n}\n\n/**\n * Get today's local date string (YYYY-MM-DD)\n */\nexport function getTodayString(): string {\n return formatDateString(new Date())\n}\n\n/**\n * Parse a YYYY-MM-DD string to a local Date object\n * Avoids timezone issues by appending T00:00:00\n */\nexport function parseLocalDate(dateStr: string): Date {\n return new Date(dateStr + 'T00:00:00')\n}\n\n// ============================================================================\n// Date Checks\n// ============================================================================\n\n/**\n * Check if a date string is today\n */\nexport function isToday(dateStr: string | null): boolean {\n if (!dateStr) return false\n return dateStr === getTodayString()\n}\n\n/**\n * Check if a date string is in the past (before today)\n */\nexport function isOverdue(dateStr: string | null): boolean {\n if (!dateStr) return false\n return dateStr < getTodayString()\n}\n\n/**\n * Check if a date is due within a threshold of days\n * @param dateStr - Date in YYYY-MM-DD format\n * @param daysThreshold - Number of days to check (default: 7)\n */\nexport function isDueSoon(dateStr: string | null, daysThreshold: number = 7): boolean {\n if (!dateStr) return false\n if (isOverdue(dateStr)) return false\n\n const today = getTodayMidnight()\n const targetDate = parseLocalDate(dateStr)\n const diffMs = targetDate.getTime() - today.getTime()\n const diffDays = Math.ceil(diffMs / (1000 * 60 * 60 * 24))\n\n return diffDays >= 0 && diffDays <= daysThreshold\n}\n\n// ============================================================================\n// Date Arithmetic\n// ============================================================================\n\n/**\n * Add days to a date string\n * @param dateStr - Date in YYYY-MM-DD format\n * @param days - Number of days to add (can be negative)\n * @returns New date string in YYYY-MM-DD format\n */\nexport function addDays(dateStr: string, days: number): string {\n const date = parseLocalDate(dateStr)\n date.setDate(date.getDate() + days)\n return formatDateString(date)\n}\n\n/**\n * Subtract days from a date string\n */\nexport function subtractDays(dateStr: string, days: number): string {\n return addDays(dateStr, -days)\n}\n\n/**\n * Get yesterday's date string (YYYY-MM-DD)\n */\nexport function getYesterdayString(): string {\n return subtractDays(getTodayString(), 1)\n}\n\n/**\n * Get tomorrow's date string (YYYY-MM-DD)\n */\nexport function getTomorrowString(): string {\n return addDays(getTodayString(), 1)\n}\n\n// ============================================================================\n// ISO String Helpers (for database queries)\n// ============================================================================\n\n/**\n * Get start of day as ISO string\n * @param dateStr - Date in YYYY-MM-DD format\n * @returns ISO string like \"2024-12-15T00:00:00.000Z\"\n */\nexport function getStartOfDayISO(dateStr: string): string {\n const date = parseLocalDate(dateStr)\n return new Date(date.getFullYear(), date.getMonth(), date.getDate()).toISOString()\n}\n\n/**\n * Get end of day as ISO string\n * @param dateStr - Date in YYYY-MM-DD format\n * @returns ISO string like \"2024-12-15T23:59:59.999Z\"\n */\nexport function getEndOfDayISO(dateStr: string): string {\n const date = parseLocalDate(dateStr)\n return new Date(\n date.getFullYear(),\n date.getMonth(),\n date.getDate(),\n 23,\n 59,\n 59,\n 999\n ).toISOString()\n}\n\n// ============================================================================\n// Week Utilities\n// ============================================================================\n\n/**\n * Get the start of the week (Monday) for a given date\n */\nexport function getWeekStart(date: Date): Date {\n const d = new Date(date)\n const day = d.getDay()\n const diff = d.getDate() - day + (day === 0 ? -6 : 1) // Monday\n d.setDate(diff)\n d.setHours(0, 0, 0, 0)\n return d\n}\n\n/**\n * Get the end of the week (Sunday) for a given week start\n */\nexport function getWeekEnd(weekStart: Date): Date {\n const d = new Date(weekStart)\n d.setDate(d.getDate() + 6)\n return d\n}\n\n/**\n * Get the start of the previous week\n */\nexport function getPreviousWeek(weekStart: Date): Date {\n const d = new Date(weekStart)\n d.setDate(d.getDate() - 7)\n return d\n}\n\n/**\n * Get the start of the next week\n */\nexport function getNextWeek(weekStart: Date): Date {\n const d = new Date(weekStart)\n d.setDate(d.getDate() + 7)\n return d\n}\n\n/**\n * Get start of week (Monday) as date string\n */\nexport function getWeekStartString(baseDate: Date = new Date()): string {\n return formatDateString(getWeekStart(baseDate))\n}\n\n/**\n * Get end of week (Sunday) as date string\n */\nexport function getWeekEndString(baseDate: Date = new Date()): string {\n return formatDateString(getWeekEnd(getWeekStart(baseDate)))\n}\n\n/**\n * Format a week range for display\n * @example \"Dec 2 - 8, 2024\" or \"Nov 25 - Dec 1, 2024\"\n */\nexport function formatWeekRange(weekStart: Date): string {\n const weekEnd = getWeekEnd(weekStart)\n const startMonth = weekStart.toLocaleDateString('en-US', { month: 'short' })\n const endMonth = weekEnd.toLocaleDateString('en-US', { month: 'short' })\n\n if (startMonth === endMonth) {\n return `${startMonth} ${weekStart.getDate()} - ${weekEnd.getDate()}, ${weekStart.getFullYear()}`\n }\n\n return `${startMonth} ${weekStart.getDate()} - ${endMonth} ${weekEnd.getDate()}, ${weekStart.getFullYear()}`\n}\n\n// ============================================================================\n// Display Formatting\n// ============================================================================\n\n/**\n * Format a date string for display with full weekday\n * @example \"Monday, December 15, 2024\"\n */\nexport function formatFullDate(dateStr: string): string {\n const date = parseLocalDate(dateStr)\n return date.toLocaleDateString('en-US', {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n })\n}\n\n/**\n * Format date for display in long form\n * @example \"Monday, 9 December\"\n */\nexport function formatDateLong(dateStr: string): string {\n const date = parseLocalDate(dateStr)\n return date.toLocaleDateString('en-GB', {\n weekday: 'long',\n day: 'numeric',\n month: 'long',\n })\n}\n\n/**\n * Format month and year\n * @example \"December 2024\"\n */\nexport function formatMonthYear(date: Date): string {\n return date.toLocaleDateString('en-US', {\n month: 'long',\n year: 'numeric',\n })\n}\n\n/**\n * Format a date/time to HH:MM format\n * Use this for formatting Date objects or ISO strings to time display\n * @example formatTimeHHMM(new Date()) => \"14:30\"\n *\n * Note: For formatting seconds (e.g., timer display), use formatTime from utils\n */\nexport function formatTimeHHMM(date: Date | string): string {\n const d = typeof date === 'string' ? new Date(date) : date\n return d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })\n}\n\n/**\n * Format a date/time to HH:MM:SS format\n */\nexport function formatTimeWithSeconds(date: Date | string): string {\n const d = typeof date === 'string' ? new Date(date) : date\n return d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' })\n}\n\n// ============================================================================\n// Contextual Formatting\n// ============================================================================\n\n/**\n * Format a date string for display as a header\n * Returns \"Overdue\", \"Today\", \"Tomorrow\", or formatted date\n */\nexport function formatDateHeader(dateStr: string): string {\n const today = getTodayString()\n\n if (dateStr < today) {\n return 'Overdue'\n }\n\n if (dateStr === today) {\n return 'Today'\n }\n\n const tomorrowStr = getTomorrowString()\n if (dateStr === tomorrowStr) {\n return 'Tomorrow'\n }\n\n const date = parseLocalDate(dateStr)\n return date.toLocaleDateString('en-US', {\n weekday: 'long',\n month: 'short',\n day: 'numeric',\n })\n}\n\n/**\n * Format a due date for display in task items (simple string version)\n * Returns \"Overdue\", \"Today\", \"Tomorrow\", or formatted date\n *\n * Note: For version that returns { text, isOverdue }, use formatDueDate from utils/formatters\n */\nexport function formatDueDateString(dateStr: string | null): string {\n if (!dateStr) return 'No due date'\n\n const today = getTodayString()\n const tomorrowStr = getTomorrowString()\n\n if (dateStr < today) {\n const date = parseLocalDate(dateStr)\n return `Overdue • ${date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' })}`\n }\n\n if (dateStr === today) {\n return 'Today'\n }\n\n if (dateStr === tomorrowStr) {\n return 'Tomorrow'\n }\n\n const date = parseLocalDate(dateStr)\n const currentYear = new Date().getFullYear()\n const dateYear = date.getFullYear()\n\n return date.toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n year: dateYear !== currentYear ? 'numeric' : undefined,\n })\n}\n\n/**\n * Format a date/time as relative time string (extended version)\n * Accepts both Date objects and ISO strings\n * @example \"Just now\", \"5m ago\", \"2h ago\", \"3d ago\"\n *\n * Note: For simple string input, you can also use formatRelativeTime from utils/formatters\n */\nexport function formatRelativeTimeExtended(dateStr: string | Date): string {\n const date = typeof dateStr === 'string' ? new Date(dateStr) : dateStr\n const now = new Date()\n const diffMs = now.getTime() - date.getTime()\n const diffMins = Math.floor(diffMs / 60000)\n const diffHours = Math.floor(diffMins / 60)\n const diffDays = Math.floor(diffHours / 24)\n\n if (diffMins < 1) return 'Just now'\n if (diffMins < 60) return `${diffMins}m ago`\n if (diffHours < 24) return `${diffHours}h ago`\n if (diffDays < 7) return `${diffDays}d ago`\n return date.toLocaleDateString()\n}\n\n/**\n * Format a due date relative to today with contextual prefix\n * @example \"Due today\", \"Due tomorrow\", \"Due in 3 days\", \"2 days overdue\"\n */\nexport function formatRelativeDueDate(\n dateStr: string,\n options?: {\n duePrefix?: string\n overduePrefix?: string\n }\n): string {\n const { duePrefix = 'Due', overduePrefix = '' } = options || {}\n const date = parseLocalDate(dateStr)\n const now = normalizeToMidnight(new Date())\n\n const diffMs = date.getTime() - now.getTime()\n const diffDays = Math.round(diffMs / (1000 * 60 * 60 * 24))\n\n if (diffDays < 0) {\n const absDays = Math.abs(diffDays)\n return overduePrefix\n ? `${overduePrefix} ${absDays} day${absDays !== 1 ? 's' : ''} overdue`\n : `${absDays} day${absDays !== 1 ? 's' : ''} overdue`\n }\n if (diffDays === 0) return `${duePrefix} today`\n if (diffDays === 1) return `${duePrefix} tomorrow`\n if (diffDays <= 7) return `${duePrefix} in ${diffDays} days`\n\n return date.toLocaleDateString('en-GB', { day: 'numeric', month: 'short' })\n}\n\n/**\n * Format a pay/income date relative to today\n * @example \"Today\", \"Tomorrow\", \"In 3 days\", \"2 days ago\"\n */\nexport function formatRelativePayDate(dateStr: string): string {\n const date = parseLocalDate(dateStr)\n const now = normalizeToMidnight(new Date())\n\n const diffMs = date.getTime() - now.getTime()\n const diffDays = Math.round(diffMs / (1000 * 60 * 60 * 24))\n\n if (diffDays < 0) {\n const absDays = Math.abs(diffDays)\n return `${absDays} day${absDays !== 1 ? 's' : ''} ago`\n }\n if (diffDays === 0) return 'Today'\n if (diffDays === 1) return 'Tomorrow'\n if (diffDays <= 7) return `In ${diffDays} days`\n\n return date.toLocaleDateString('en-GB', { day: 'numeric', month: 'short' })\n}\n\n// ============================================================================\n// Localized Formatting\n// ============================================================================\n\nexport type DateFormat = 'short' | 'medium' | 'long' | 'weekday'\nexport type TimeFormat = 'short' | 'withSeconds'\n\n/**\n * Format a date with various preset formats\n */\nexport function formatDateLocalized(date: Date | string, format: DateFormat = 'medium'): string {\n const d = typeof date === 'string' ? new Date(date) : date\n\n switch (format) {\n case 'short':\n return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric' })\n case 'medium':\n return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })\n case 'long':\n return d.toLocaleDateString('en-US', {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n })\n case 'weekday':\n return d.toLocaleDateString('en-US', { weekday: 'short' })\n default:\n return d.toLocaleDateString()\n }\n}\n\n/**\n * Format a time with various preset formats\n */\nexport function formatTimeLocalized(date: Date | string, format: TimeFormat = 'short'): string {\n const d = typeof date === 'string' ? new Date(date) : date\n\n switch (format) {\n case 'short':\n return d.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit', hour12: true })\n case 'withSeconds':\n return d.toLocaleTimeString('en-US', {\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: true,\n })\n default:\n return d.toLocaleTimeString()\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I;AAEtD,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO,EAAE,mBAAmB,SAAS,EAAE,MAAM,WAAW,QAAQ,WAAW,QAAQ,KAAK,CAAC;AAAA,IAC3F,KAAK;AACH,aAAO,EAAE,mBAAmB,SAAS;AAAA,QACnC,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,QAAQ;AAAA,MACV,CAAC;AAAA,IACH;AACE,aAAO,EAAE,mBAAmB;AAAA,EAChC;AACF;","names":["date"]}
1
+ {"version":3,"sources":["../../src/date/index.ts"],"sourcesContent":["/**\n * Date Utilities\n *\n * Pure functions for date manipulation and formatting.\n * Works in both Node.js and browser/React Native environments.\n *\n * @example\n * import { getTodayString, addDays, formatRelativeTime } from '@mrck-labs/vanaheim-shared/date'\n *\n * const today = getTodayString() // \"2024-12-16\"\n * const nextWeek = addDays(today, 7) // \"2024-12-23\"\n */\n\n// ============================================================================\n// Core Utilities\n// ============================================================================\n\n/**\n * Normalize a date to midnight (00:00:00.000)\n */\nexport function normalizeToMidnight(date: Date): Date {\n const d = new Date(date)\n d.setHours(0, 0, 0, 0)\n return d\n}\n\n/**\n * Get today's date normalized to midnight\n */\nexport function getTodayMidnight(): Date {\n return normalizeToMidnight(new Date())\n}\n\n/**\n * Format a Date object to YYYY-MM-DD string\n * @example formatDateString(new Date()) => \"2024-12-16\"\n */\nexport function formatDateString(date: Date): string {\n return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`\n}\n\n/**\n * Get today's local date string (YYYY-MM-DD)\n */\nexport function getTodayString(): string {\n return formatDateString(new Date())\n}\n\n/**\n * Parse a YYYY-MM-DD string to a local Date object\n * Avoids timezone issues by appending T00:00:00\n */\nexport function parseLocalDate(dateStr: string): Date {\n return new Date(dateStr + 'T00:00:00')\n}\n\n// ============================================================================\n// Date Checks\n// ============================================================================\n\n/**\n * Check if a date string is today\n */\nexport function isToday(dateStr: string | null): boolean {\n if (!dateStr) return false\n return dateStr === getTodayString()\n}\n\n/**\n * Check if a date string is in the past (before today)\n */\nexport function isOverdue(dateStr: string | null): boolean {\n if (!dateStr) return false\n return dateStr < getTodayString()\n}\n\n/**\n * Check if a date is due within a threshold of days\n * @param dateStr - Date in YYYY-MM-DD format\n * @param daysThreshold - Number of days to check (default: 7)\n */\nexport function isDueSoon(dateStr: string | null, daysThreshold: number = 7): boolean {\n if (!dateStr) return false\n if (isOverdue(dateStr)) return false\n\n const today = getTodayMidnight()\n const targetDate = parseLocalDate(dateStr)\n const diffMs = targetDate.getTime() - today.getTime()\n const diffDays = Math.ceil(diffMs / (1000 * 60 * 60 * 24))\n\n return diffDays >= 0 && diffDays <= daysThreshold\n}\n\n// ============================================================================\n// Date Arithmetic\n// ============================================================================\n\n/**\n * Add days to a date string\n * @param dateStr - Date in YYYY-MM-DD format\n * @param days - Number of days to add (can be negative)\n * @returns New date string in YYYY-MM-DD format\n */\nexport function addDays(dateStr: string, days: number): string {\n const date = parseLocalDate(dateStr)\n date.setDate(date.getDate() + days)\n return formatDateString(date)\n}\n\n/**\n * Subtract days from a date string\n */\nexport function subtractDays(dateStr: string, days: number): string {\n return addDays(dateStr, -days)\n}\n\n/**\n * Get yesterday's date string (YYYY-MM-DD)\n */\nexport function getYesterdayString(): string {\n return subtractDays(getTodayString(), 1)\n}\n\n/**\n * Get tomorrow's date string (YYYY-MM-DD)\n */\nexport function getTomorrowString(): string {\n return addDays(getTodayString(), 1)\n}\n\n// ============================================================================\n// ISO String Helpers (for database queries)\n// ============================================================================\n\n/**\n * Get start of day as ISO string\n * @param dateStr - Date in YYYY-MM-DD format\n * @returns ISO string like \"2024-12-15T00:00:00.000Z\"\n */\nexport function getStartOfDayISO(dateStr: string): string {\n const date = parseLocalDate(dateStr)\n return new Date(date.getFullYear(), date.getMonth(), date.getDate()).toISOString()\n}\n\n/**\n * Get end of day as ISO string\n * @param dateStr - Date in YYYY-MM-DD format\n * @returns ISO string like \"2024-12-15T23:59:59.999Z\"\n */\nexport function getEndOfDayISO(dateStr: string): string {\n const date = parseLocalDate(dateStr)\n return new Date(\n date.getFullYear(),\n date.getMonth(),\n date.getDate(),\n 23,\n 59,\n 59,\n 999\n ).toISOString()\n}\n\n// ============================================================================\n// Week Utilities\n// ============================================================================\n\n/**\n * Get the start of the week (Monday) for a given date\n */\nexport function getWeekStart(date: Date): Date {\n const d = new Date(date)\n const day = d.getDay()\n const diff = d.getDate() - day + (day === 0 ? -6 : 1) // Monday\n d.setDate(diff)\n d.setHours(0, 0, 0, 0)\n return d\n}\n\n/**\n * Get the end of the week (Sunday) for a given week start\n */\nexport function getWeekEnd(weekStart: Date): Date {\n const d = new Date(weekStart)\n d.setDate(d.getDate() + 6)\n return d\n}\n\n/**\n * Get the start of the previous week\n */\nexport function getPreviousWeek(weekStart: Date): Date {\n const d = new Date(weekStart)\n d.setDate(d.getDate() - 7)\n return d\n}\n\n/**\n * Get the start of the next week\n */\nexport function getNextWeek(weekStart: Date): Date {\n const d = new Date(weekStart)\n d.setDate(d.getDate() + 7)\n return d\n}\n\n/**\n * Get start of week (Monday) as date string\n */\nexport function getWeekStartString(baseDate: Date = new Date()): string {\n return formatDateString(getWeekStart(baseDate))\n}\n\n/**\n * Get end of week (Sunday) as date string\n */\nexport function getWeekEndString(baseDate: Date = new Date()): string {\n return formatDateString(getWeekEnd(getWeekStart(baseDate)))\n}\n\n/**\n * Format a week range for display\n * @example \"Dec 2 - 8, 2024\" or \"Nov 25 - Dec 1, 2024\"\n */\nexport function formatWeekRange(weekStart: Date): string {\n const weekEnd = getWeekEnd(weekStart)\n const startMonth = weekStart.toLocaleDateString('en-US', { month: 'short' })\n const endMonth = weekEnd.toLocaleDateString('en-US', { month: 'short' })\n\n if (startMonth === endMonth) {\n return `${startMonth} ${weekStart.getDate()} - ${weekEnd.getDate()}, ${weekStart.getFullYear()}`\n }\n\n return `${startMonth} ${weekStart.getDate()} - ${endMonth} ${weekEnd.getDate()}, ${weekStart.getFullYear()}`\n}\n\n// ============================================================================\n// Display Formatting\n// ============================================================================\n\n/**\n * Format a date string for display with full weekday\n * @example \"Monday, December 15, 2024\"\n */\nexport function formatFullDate(dateStr: string): string {\n const date = parseLocalDate(dateStr)\n return date.toLocaleDateString('en-US', {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n })\n}\n\n/**\n * Format date for display in long form\n * @example \"Monday, 9 December\"\n */\nexport function formatDateLong(dateStr: string): string {\n const date = parseLocalDate(dateStr)\n return date.toLocaleDateString('en-GB', {\n weekday: 'long',\n day: 'numeric',\n month: 'long',\n })\n}\n\n/**\n * Format month and year\n * @example \"December 2024\"\n */\nexport function formatMonthYear(date: Date): string {\n return date.toLocaleDateString('en-US', {\n month: 'long',\n year: 'numeric',\n })\n}\n\n/**\n * Format a date/time to HH:MM format\n * Use this for formatting Date objects or ISO strings to time display\n * @example formatTimeHHMM(new Date()) => \"14:30\"\n *\n * Note: For formatting seconds (e.g., timer display), use formatTime from utils\n */\nexport function formatTimeHHMM(date: Date | string): string {\n const d = typeof date === 'string' ? new Date(date) : date\n return d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })\n}\n\n/**\n * Format time in short format (12h without seconds)\n * @example formatTimeShort(new Date()) => \"2:30 PM\"\n */\nexport function formatTimeShort(date: Date | string): string {\n const d = typeof date === 'string' ? new Date(date) : date\n return d.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit' })\n}\n\n/**\n * Format a Date object for display in readable format\n * @example formatDateDisplay(new Date()) => \"Monday, Dec 22\"\n */\nexport function formatDateDisplay(date: Date): string {\n return date.toLocaleDateString('en-US', {\n weekday: 'long',\n month: 'short',\n day: 'numeric',\n })\n}\n\n/**\n * Format a date/time to HH:MM:SS format\n */\nexport function formatTimeWithSeconds(date: Date | string): string {\n const d = typeof date === 'string' ? new Date(date) : date\n return d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' })\n}\n\n// ============================================================================\n// Contextual Formatting\n// ============================================================================\n\n/**\n * Format a date string for display as a header\n * Returns \"Overdue\", \"Today\", \"Tomorrow\", or formatted date\n */\nexport function formatDateHeader(dateStr: string): string {\n const today = getTodayString()\n\n if (dateStr < today) {\n return 'Overdue'\n }\n\n if (dateStr === today) {\n return 'Today'\n }\n\n const tomorrowStr = getTomorrowString()\n if (dateStr === tomorrowStr) {\n return 'Tomorrow'\n }\n\n const date = parseLocalDate(dateStr)\n return date.toLocaleDateString('en-US', {\n weekday: 'long',\n month: 'short',\n day: 'numeric',\n })\n}\n\n/**\n * Format a due date for display in task items (simple string version)\n * Returns \"Overdue\", \"Today\", \"Tomorrow\", or formatted date\n *\n * Note: For version that returns { text, isOverdue }, use formatDueDate from utils/formatters\n */\nexport function formatDueDateString(dateStr: string | null): string {\n if (!dateStr) return 'No due date'\n\n const today = getTodayString()\n const tomorrowStr = getTomorrowString()\n\n if (dateStr < today) {\n const date = parseLocalDate(dateStr)\n return `Overdue • ${date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' })}`\n }\n\n if (dateStr === today) {\n return 'Today'\n }\n\n if (dateStr === tomorrowStr) {\n return 'Tomorrow'\n }\n\n const date = parseLocalDate(dateStr)\n const currentYear = new Date().getFullYear()\n const dateYear = date.getFullYear()\n\n return date.toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n year: dateYear !== currentYear ? 'numeric' : undefined,\n })\n}\n\n/**\n * Format a date/time as relative time string (extended version)\n * Accepts both Date objects and ISO strings\n * @example \"Just now\", \"5m ago\", \"2h ago\", \"3d ago\"\n *\n * Note: For simple string input, you can also use formatRelativeTime from utils/formatters\n */\nexport function formatRelativeTimeExtended(dateStr: string | Date): string {\n const date = typeof dateStr === 'string' ? new Date(dateStr) : dateStr\n const now = new Date()\n const diffMs = now.getTime() - date.getTime()\n const diffMins = Math.floor(diffMs / 60000)\n const diffHours = Math.floor(diffMins / 60)\n const diffDays = Math.floor(diffHours / 24)\n\n if (diffMins < 1) return 'Just now'\n if (diffMins < 60) return `${diffMins}m ago`\n if (diffHours < 24) return `${diffHours}h ago`\n if (diffDays < 7) return `${diffDays}d ago`\n return date.toLocaleDateString()\n}\n\n/**\n * Format a due date relative to today with contextual prefix\n * @example \"Due today\", \"Due tomorrow\", \"Due in 3 days\", \"2 days overdue\"\n */\nexport function formatRelativeDueDate(\n dateStr: string,\n options?: {\n duePrefix?: string\n overduePrefix?: string\n }\n): string {\n const { duePrefix = 'Due', overduePrefix = '' } = options || {}\n const date = parseLocalDate(dateStr)\n const now = normalizeToMidnight(new Date())\n\n const diffMs = date.getTime() - now.getTime()\n const diffDays = Math.round(diffMs / (1000 * 60 * 60 * 24))\n\n if (diffDays < 0) {\n const absDays = Math.abs(diffDays)\n return overduePrefix\n ? `${overduePrefix} ${absDays} day${absDays !== 1 ? 's' : ''} overdue`\n : `${absDays} day${absDays !== 1 ? 's' : ''} overdue`\n }\n if (diffDays === 0) return `${duePrefix} today`\n if (diffDays === 1) return `${duePrefix} tomorrow`\n if (diffDays <= 7) return `${duePrefix} in ${diffDays} days`\n\n return date.toLocaleDateString('en-GB', { day: 'numeric', month: 'short' })\n}\n\n/**\n * Format a pay/income date relative to today\n * @example \"Today\", \"Tomorrow\", \"In 3 days\", \"2 days ago\"\n */\nexport function formatRelativePayDate(dateStr: string): string {\n const date = parseLocalDate(dateStr)\n const now = normalizeToMidnight(new Date())\n\n const diffMs = date.getTime() - now.getTime()\n const diffDays = Math.round(diffMs / (1000 * 60 * 60 * 24))\n\n if (diffDays < 0) {\n const absDays = Math.abs(diffDays)\n return `${absDays} day${absDays !== 1 ? 's' : ''} ago`\n }\n if (diffDays === 0) return 'Today'\n if (diffDays === 1) return 'Tomorrow'\n if (diffDays <= 7) return `In ${diffDays} days`\n\n return date.toLocaleDateString('en-GB', { day: 'numeric', month: 'short' })\n}\n\n// ============================================================================\n// Localized Formatting\n// ============================================================================\n\nexport type DateFormat = 'short' | 'medium' | 'long' | 'weekday'\nexport type TimeFormat = 'short' | 'withSeconds'\n\n/**\n * Format a date with various preset formats\n */\nexport function formatDateLocalized(date: Date | string, format: DateFormat = 'medium'): string {\n const d = typeof date === 'string' ? new Date(date) : date\n\n switch (format) {\n case 'short':\n return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric' })\n case 'medium':\n return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })\n case 'long':\n return d.toLocaleDateString('en-US', {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n })\n case 'weekday':\n return d.toLocaleDateString('en-US', { weekday: 'short' })\n default:\n return d.toLocaleDateString()\n }\n}\n\n/**\n * Format a time with various preset formats\n */\nexport function formatTimeLocalized(date: Date | string, format: TimeFormat = 'short'): string {\n const d = typeof date === 'string' ? new Date(date) : date\n\n switch (format) {\n case 'short':\n return d.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit', hour12: true })\n case 'withSeconds':\n return d.toLocaleTimeString('en-US', {\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: true,\n })\n default:\n return d.toLocaleTimeString()\n }\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBO,SAAS,oBAAoB,MAAkB;AACpD,QAAM,IAAI,IAAI,KAAK,IAAI;AACvB,IAAE,SAAS,GAAG,GAAG,GAAG,CAAC;AACrB,SAAO;AACT;AAKO,SAAS,mBAAyB;AACvC,SAAO,oBAAoB,oBAAI,KAAK,CAAC;AACvC;AAMO,SAAS,iBAAiB,MAAoB;AACnD,SAAO,GAAG,KAAK,YAAY,CAAC,IAAI,OAAO,KAAK,SAAS,IAAI,CAAC,EAAE,SAA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A,IACH;AACE,aAAO,EAAE,mBAAmB;AAAA,EAChC;AACF;","names":["date"]}
@@ -128,6 +128,17 @@ function formatTimeHHMM(date) {
128
128
  const d = typeof date === "string" ? new Date(date) : date;
129
129
  return d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
130
130
  }
131
+ function formatTimeShort(date) {
132
+ const d = typeof date === "string" ? new Date(date) : date;
133
+ return d.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
134
+ }
135
+ function formatDateDisplay(date) {
136
+ return date.toLocaleDateString("en-US", {
137
+ weekday: "long",
138
+ month: "short",
139
+ day: "numeric"
140
+ });
141
+ }
131
142
  function formatTimeWithSeconds(date) {
132
143
  const d = typeof date === "string" ? new Date(date) : date;
133
144
  return d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", second: "2-digit" });
@@ -254,6 +265,7 @@ function formatTimeLocalized(date, format = "short") {
254
265
  }
255
266
  export {
256
267
  addDays,
268
+ formatDateDisplay,
257
269
  formatDateHeader,
258
270
  formatDateLocalized,
259
271
  formatDateLong,
@@ -266,6 +278,7 @@ export {
266
278
  formatRelativeTimeExtended,
267
279
  formatTimeHHMM,
268
280
  formatTimeLocalized,
281
+ formatTimeShort,
269
282
  formatTimeWithSeconds,
270
283
  formatWeekRange,
271
284
  getEndOfDayISO,