@mrck-labs/vanaheim-shared 0.3.0 → 0.4.1
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.
- package/dist/{database-3Vv5PNDa.d.mts → database-koVAareN.d.mts} +150 -1
- package/dist/{database-3Vv5PNDa.d.ts → database-koVAareN.d.ts} +150 -1
- package/dist/date/index.d.mts +26 -3
- package/dist/date/index.d.ts +26 -3
- package/dist/date/index.js +63 -6
- package/dist/date/index.js.map +1 -1
- package/dist/date/index.mjs +59 -6
- package/dist/date/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +151 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +147 -6
- package/dist/index.mjs.map +1 -1
- package/dist/query/index.d.mts +95 -0
- package/dist/query/index.d.ts +95 -0
- package/dist/query/index.js +88 -0
- package/dist/query/index.js.map +1 -1
- package/dist/query/index.mjs +88 -0
- package/dist/query/index.mjs.map +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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 };
|
package/dist/date/index.d.mts
CHANGED
|
@@ -101,6 +101,19 @@ declare function getWeekStartString(baseDate?: Date): string;
|
|
|
101
101
|
* Get end of week (Sunday) as date string
|
|
102
102
|
*/
|
|
103
103
|
declare function getWeekEndString(baseDate?: Date): string;
|
|
104
|
+
/**
|
|
105
|
+
* Get all dates in a week as an array of date strings
|
|
106
|
+
* @param weekStart - Start of the week (Monday) in YYYY-MM-DD format
|
|
107
|
+
* @returns Array of 7 date strings from Monday to Sunday
|
|
108
|
+
* @example getWeekDates("2024-12-16") => ["2024-12-16", "2024-12-17", ..., "2024-12-22"]
|
|
109
|
+
*/
|
|
110
|
+
declare function getWeekDates(weekStart: string): string[];
|
|
111
|
+
/**
|
|
112
|
+
* Get all dates in a week as Date objects
|
|
113
|
+
* @param weekStart - Start of the week (Monday) as Date
|
|
114
|
+
* @returns Array of 7 Date objects from Monday to Sunday
|
|
115
|
+
*/
|
|
116
|
+
declare function getWeekDatesAsObjects(weekStart: Date): Date[];
|
|
104
117
|
/**
|
|
105
118
|
* Format a week range for display
|
|
106
119
|
* @example "Dec 2 - 8, 2024" or "Nov 25 - Dec 1, 2024"
|
|
@@ -129,6 +142,16 @@ declare function formatMonthYear(date: Date): string;
|
|
|
129
142
|
* Note: For formatting seconds (e.g., timer display), use formatTime from utils
|
|
130
143
|
*/
|
|
131
144
|
declare function formatTimeHHMM(date: Date | string): string;
|
|
145
|
+
/**
|
|
146
|
+
* Format time in short format (12h without seconds)
|
|
147
|
+
* @example formatTimeShort(new Date()) => "2:30 PM"
|
|
148
|
+
*/
|
|
149
|
+
declare function formatTimeShort(date: Date | string): string;
|
|
150
|
+
/**
|
|
151
|
+
* Format a Date object for display in readable format
|
|
152
|
+
* @example formatDateDisplay(new Date()) => "Monday, Dec 22"
|
|
153
|
+
*/
|
|
154
|
+
declare function formatDateDisplay(date: Date): string;
|
|
132
155
|
/**
|
|
133
156
|
* Format a date/time to HH:MM:SS format
|
|
134
157
|
*/
|
|
@@ -166,8 +189,8 @@ declare function formatRelativeDueDate(dateStr: string, options?: {
|
|
|
166
189
|
* @example "Today", "Tomorrow", "In 3 days", "2 days ago"
|
|
167
190
|
*/
|
|
168
191
|
declare function formatRelativePayDate(dateStr: string): string;
|
|
169
|
-
type DateFormat =
|
|
170
|
-
type TimeFormat =
|
|
192
|
+
type DateFormat = "short" | "medium" | "long" | "weekday";
|
|
193
|
+
type TimeFormat = "short" | "withSeconds";
|
|
171
194
|
/**
|
|
172
195
|
* Format a date with various preset formats
|
|
173
196
|
*/
|
|
@@ -177,4 +200,4 @@ declare function formatDateLocalized(date: Date | string, format?: DateFormat):
|
|
|
177
200
|
*/
|
|
178
201
|
declare function formatTimeLocalized(date: Date | string, format?: TimeFormat): string;
|
|
179
202
|
|
|
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 };
|
|
203
|
+
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, getWeekDates, getWeekDatesAsObjects, getWeekEnd, getWeekEndString, getWeekStart, getWeekStartString, getYesterdayString, isDueSoon, isOverdue, isToday, normalizeToMidnight, parseLocalDate, subtractDays };
|
package/dist/date/index.d.ts
CHANGED
|
@@ -101,6 +101,19 @@ declare function getWeekStartString(baseDate?: Date): string;
|
|
|
101
101
|
* Get end of week (Sunday) as date string
|
|
102
102
|
*/
|
|
103
103
|
declare function getWeekEndString(baseDate?: Date): string;
|
|
104
|
+
/**
|
|
105
|
+
* Get all dates in a week as an array of date strings
|
|
106
|
+
* @param weekStart - Start of the week (Monday) in YYYY-MM-DD format
|
|
107
|
+
* @returns Array of 7 date strings from Monday to Sunday
|
|
108
|
+
* @example getWeekDates("2024-12-16") => ["2024-12-16", "2024-12-17", ..., "2024-12-22"]
|
|
109
|
+
*/
|
|
110
|
+
declare function getWeekDates(weekStart: string): string[];
|
|
111
|
+
/**
|
|
112
|
+
* Get all dates in a week as Date objects
|
|
113
|
+
* @param weekStart - Start of the week (Monday) as Date
|
|
114
|
+
* @returns Array of 7 Date objects from Monday to Sunday
|
|
115
|
+
*/
|
|
116
|
+
declare function getWeekDatesAsObjects(weekStart: Date): Date[];
|
|
104
117
|
/**
|
|
105
118
|
* Format a week range for display
|
|
106
119
|
* @example "Dec 2 - 8, 2024" or "Nov 25 - Dec 1, 2024"
|
|
@@ -129,6 +142,16 @@ declare function formatMonthYear(date: Date): string;
|
|
|
129
142
|
* Note: For formatting seconds (e.g., timer display), use formatTime from utils
|
|
130
143
|
*/
|
|
131
144
|
declare function formatTimeHHMM(date: Date | string): string;
|
|
145
|
+
/**
|
|
146
|
+
* Format time in short format (12h without seconds)
|
|
147
|
+
* @example formatTimeShort(new Date()) => "2:30 PM"
|
|
148
|
+
*/
|
|
149
|
+
declare function formatTimeShort(date: Date | string): string;
|
|
150
|
+
/**
|
|
151
|
+
* Format a Date object for display in readable format
|
|
152
|
+
* @example formatDateDisplay(new Date()) => "Monday, Dec 22"
|
|
153
|
+
*/
|
|
154
|
+
declare function formatDateDisplay(date: Date): string;
|
|
132
155
|
/**
|
|
133
156
|
* Format a date/time to HH:MM:SS format
|
|
134
157
|
*/
|
|
@@ -166,8 +189,8 @@ declare function formatRelativeDueDate(dateStr: string, options?: {
|
|
|
166
189
|
* @example "Today", "Tomorrow", "In 3 days", "2 days ago"
|
|
167
190
|
*/
|
|
168
191
|
declare function formatRelativePayDate(dateStr: string): string;
|
|
169
|
-
type DateFormat =
|
|
170
|
-
type TimeFormat =
|
|
192
|
+
type DateFormat = "short" | "medium" | "long" | "weekday";
|
|
193
|
+
type TimeFormat = "short" | "withSeconds";
|
|
171
194
|
/**
|
|
172
195
|
* Format a date with various preset formats
|
|
173
196
|
*/
|
|
@@ -177,4 +200,4 @@ declare function formatDateLocalized(date: Date | string, format?: DateFormat):
|
|
|
177
200
|
*/
|
|
178
201
|
declare function formatTimeLocalized(date: Date | string, format?: TimeFormat): string;
|
|
179
202
|
|
|
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 };
|
|
203
|
+
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, getWeekDates, getWeekDatesAsObjects, getWeekEnd, getWeekEndString, getWeekStart, getWeekStartString, getYesterdayString, isDueSoon, isOverdue, isToday, normalizeToMidnight, parseLocalDate, subtractDays };
|
package/dist/date/index.js
CHANGED
|
@@ -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,
|
|
@@ -42,6 +44,8 @@ __export(date_exports, {
|
|
|
42
44
|
getTodayMidnight: () => getTodayMidnight,
|
|
43
45
|
getTodayString: () => getTodayString,
|
|
44
46
|
getTomorrowString: () => getTomorrowString,
|
|
47
|
+
getWeekDates: () => getWeekDates,
|
|
48
|
+
getWeekDatesAsObjects: () => getWeekDatesAsObjects,
|
|
45
49
|
getWeekEnd: () => getWeekEnd,
|
|
46
50
|
getWeekEndString: () => getWeekEndString,
|
|
47
51
|
getWeekStart: () => getWeekStart,
|
|
@@ -64,7 +68,10 @@ function getTodayMidnight() {
|
|
|
64
68
|
return normalizeToMidnight(/* @__PURE__ */ new Date());
|
|
65
69
|
}
|
|
66
70
|
function formatDateString(date) {
|
|
67
|
-
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(
|
|
71
|
+
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(
|
|
72
|
+
2,
|
|
73
|
+
"0"
|
|
74
|
+
)}-${String(date.getDate()).padStart(2, "0")}`;
|
|
68
75
|
}
|
|
69
76
|
function getTodayString() {
|
|
70
77
|
return formatDateString(/* @__PURE__ */ new Date());
|
|
@@ -105,7 +112,11 @@ function getTomorrowString() {
|
|
|
105
112
|
}
|
|
106
113
|
function getStartOfDayISO(dateStr) {
|
|
107
114
|
const date = parseLocalDate(dateStr);
|
|
108
|
-
return new Date(
|
|
115
|
+
return new Date(
|
|
116
|
+
date.getFullYear(),
|
|
117
|
+
date.getMonth(),
|
|
118
|
+
date.getDate()
|
|
119
|
+
).toISOString();
|
|
109
120
|
}
|
|
110
121
|
function getEndOfDayISO(dateStr) {
|
|
111
122
|
const date = parseLocalDate(dateStr);
|
|
@@ -148,6 +159,22 @@ function getWeekStartString(baseDate = /* @__PURE__ */ new Date()) {
|
|
|
148
159
|
function getWeekEndString(baseDate = /* @__PURE__ */ new Date()) {
|
|
149
160
|
return formatDateString(getWeekEnd(getWeekStart(baseDate)));
|
|
150
161
|
}
|
|
162
|
+
function getWeekDates(weekStart) {
|
|
163
|
+
const dates = [];
|
|
164
|
+
for (let i = 0; i < 7; i++) {
|
|
165
|
+
dates.push(addDays(weekStart, i));
|
|
166
|
+
}
|
|
167
|
+
return dates;
|
|
168
|
+
}
|
|
169
|
+
function getWeekDatesAsObjects(weekStart) {
|
|
170
|
+
const dates = [];
|
|
171
|
+
for (let i = 0; i < 7; i++) {
|
|
172
|
+
const day = new Date(weekStart);
|
|
173
|
+
day.setDate(day.getDate() + i);
|
|
174
|
+
dates.push(day);
|
|
175
|
+
}
|
|
176
|
+
return dates;
|
|
177
|
+
}
|
|
151
178
|
function formatWeekRange(weekStart) {
|
|
152
179
|
const weekEnd = getWeekEnd(weekStart);
|
|
153
180
|
const startMonth = weekStart.toLocaleDateString("en-US", { month: "short" });
|
|
@@ -184,9 +211,24 @@ function formatTimeHHMM(date) {
|
|
|
184
211
|
const d = typeof date === "string" ? new Date(date) : date;
|
|
185
212
|
return d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
186
213
|
}
|
|
214
|
+
function formatTimeShort(date) {
|
|
215
|
+
const d = typeof date === "string" ? new Date(date) : date;
|
|
216
|
+
return d.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
|
|
217
|
+
}
|
|
218
|
+
function formatDateDisplay(date) {
|
|
219
|
+
return date.toLocaleDateString("en-US", {
|
|
220
|
+
weekday: "long",
|
|
221
|
+
month: "short",
|
|
222
|
+
day: "numeric"
|
|
223
|
+
});
|
|
224
|
+
}
|
|
187
225
|
function formatTimeWithSeconds(date) {
|
|
188
226
|
const d = typeof date === "string" ? new Date(date) : date;
|
|
189
|
-
return d.toLocaleTimeString([], {
|
|
227
|
+
return d.toLocaleTimeString([], {
|
|
228
|
+
hour: "2-digit",
|
|
229
|
+
minute: "2-digit",
|
|
230
|
+
second: "2-digit"
|
|
231
|
+
});
|
|
190
232
|
}
|
|
191
233
|
function formatDateHeader(dateStr) {
|
|
192
234
|
const today = getTodayString();
|
|
@@ -213,7 +255,10 @@ function formatDueDateString(dateStr) {
|
|
|
213
255
|
const tomorrowStr = getTomorrowString();
|
|
214
256
|
if (dateStr < today) {
|
|
215
257
|
const date2 = parseLocalDate(dateStr);
|
|
216
|
-
return `Overdue \u2022 ${date2.toLocaleDateString("en-US", {
|
|
258
|
+
return `Overdue \u2022 ${date2.toLocaleDateString("en-US", {
|
|
259
|
+
month: "short",
|
|
260
|
+
day: "numeric"
|
|
261
|
+
})}`;
|
|
217
262
|
}
|
|
218
263
|
if (dateStr === today) {
|
|
219
264
|
return "Today";
|
|
@@ -278,7 +323,11 @@ function formatDateLocalized(date, format = "medium") {
|
|
|
278
323
|
case "short":
|
|
279
324
|
return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
280
325
|
case "medium":
|
|
281
|
-
return d.toLocaleDateString("en-US", {
|
|
326
|
+
return d.toLocaleDateString("en-US", {
|
|
327
|
+
month: "short",
|
|
328
|
+
day: "numeric",
|
|
329
|
+
year: "numeric"
|
|
330
|
+
});
|
|
282
331
|
case "long":
|
|
283
332
|
return d.toLocaleDateString("en-US", {
|
|
284
333
|
weekday: "long",
|
|
@@ -296,7 +345,11 @@ function formatTimeLocalized(date, format = "short") {
|
|
|
296
345
|
const d = typeof date === "string" ? new Date(date) : date;
|
|
297
346
|
switch (format) {
|
|
298
347
|
case "short":
|
|
299
|
-
return d.toLocaleTimeString("en-US", {
|
|
348
|
+
return d.toLocaleTimeString("en-US", {
|
|
349
|
+
hour: "2-digit",
|
|
350
|
+
minute: "2-digit",
|
|
351
|
+
hour12: true
|
|
352
|
+
});
|
|
300
353
|
case "withSeconds":
|
|
301
354
|
return d.toLocaleTimeString("en-US", {
|
|
302
355
|
hour: "2-digit",
|
|
@@ -311,6 +364,7 @@ function formatTimeLocalized(date, format = "short") {
|
|
|
311
364
|
// Annotate the CommonJS export names for ESM import in node:
|
|
312
365
|
0 && (module.exports = {
|
|
313
366
|
addDays,
|
|
367
|
+
formatDateDisplay,
|
|
314
368
|
formatDateHeader,
|
|
315
369
|
formatDateLocalized,
|
|
316
370
|
formatDateLong,
|
|
@@ -323,6 +377,7 @@ function formatTimeLocalized(date, format = "short") {
|
|
|
323
377
|
formatRelativeTimeExtended,
|
|
324
378
|
formatTimeHHMM,
|
|
325
379
|
formatTimeLocalized,
|
|
380
|
+
formatTimeShort,
|
|
326
381
|
formatTimeWithSeconds,
|
|
327
382
|
formatWeekRange,
|
|
328
383
|
getEndOfDayISO,
|
|
@@ -332,6 +387,8 @@ function formatTimeLocalized(date, format = "short") {
|
|
|
332
387
|
getTodayMidnight,
|
|
333
388
|
getTodayString,
|
|
334
389
|
getTomorrowString,
|
|
390
|
+
getWeekDates,
|
|
391
|
+
getWeekDatesAsObjects,
|
|
335
392
|
getWeekEnd,
|
|
336
393
|
getWeekEndString,
|
|
337
394
|
getWeekStart,
|