@exyconn/common 2.0.0 → 2.3.2
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/README.md +864 -261
- package/dist/{index-BLltj-zN.d.ts → client/hooks/index.d.mts} +1 -195
- package/dist/{index-CIUdLBjA.d.mts → client/hooks/index.d.ts} +1 -195
- package/dist/client/hooks/index.js +2276 -0
- package/dist/client/hooks/index.js.map +1 -0
- package/dist/client/hooks/index.mjs +2217 -0
- package/dist/client/hooks/index.mjs.map +1 -0
- package/dist/client/index.d.mts +4 -1
- package/dist/client/index.d.ts +4 -1
- package/dist/client/index.js +2693 -19
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +2634 -21
- package/dist/client/index.mjs.map +1 -1
- package/dist/client/web/index.d.mts +1461 -0
- package/dist/client/web/index.d.ts +1461 -0
- package/dist/client/web/index.js +2681 -0
- package/dist/client/web/index.js.map +1 -0
- package/dist/client/web/index.mjs +2618 -0
- package/dist/client/web/index.mjs.map +1 -0
- package/dist/data/brand-identity.d.mts +149 -0
- package/dist/data/brand-identity.d.ts +149 -0
- package/dist/data/brand-identity.js +235 -0
- package/dist/data/brand-identity.js.map +1 -0
- package/dist/data/brand-identity.mjs +220 -0
- package/dist/data/brand-identity.mjs.map +1 -0
- package/dist/data/countries.d.mts +61 -0
- package/dist/data/countries.d.ts +61 -0
- package/dist/data/countries.js +987 -0
- package/dist/data/countries.js.map +1 -0
- package/dist/data/countries.mjs +971 -0
- package/dist/data/countries.mjs.map +1 -0
- package/dist/data/currencies.d.mts +19 -0
- package/dist/data/currencies.d.ts +19 -0
- package/dist/data/currencies.js +162 -0
- package/dist/data/currencies.js.map +1 -0
- package/dist/data/currencies.mjs +153 -0
- package/dist/data/currencies.mjs.map +1 -0
- package/dist/data/index.d.mts +7 -0
- package/dist/data/index.d.ts +7 -0
- package/dist/data/index.js +2087 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data/index.mjs +1948 -0
- package/dist/data/index.mjs.map +1 -0
- package/dist/data/phone-codes.d.mts +15 -0
- package/dist/data/phone-codes.d.ts +15 -0
- package/dist/data/phone-codes.js +219 -0
- package/dist/data/phone-codes.js.map +1 -0
- package/dist/data/phone-codes.mjs +211 -0
- package/dist/data/phone-codes.mjs.map +1 -0
- package/dist/data/regex.d.mts +287 -0
- package/dist/data/regex.d.ts +287 -0
- package/dist/data/regex.js +306 -0
- package/dist/data/regex.js.map +1 -0
- package/dist/data/regex.mjs +208 -0
- package/dist/data/regex.mjs.map +1 -0
- package/dist/data/timezones.d.mts +16 -0
- package/dist/data/timezones.d.ts +16 -0
- package/dist/data/timezones.js +98 -0
- package/dist/data/timezones.js.map +1 -0
- package/dist/data/timezones.mjs +89 -0
- package/dist/data/timezones.mjs.map +1 -0
- package/dist/index-01hoqibP.d.ts +119 -0
- package/dist/index-D3yCCjBZ.d.mts +119 -0
- package/dist/index-D9a9oxQy.d.ts +305 -0
- package/dist/index-DKn4raO7.d.ts +222 -0
- package/dist/index-DuxL84IW.d.mts +305 -0
- package/dist/index-NS8dS0p9.d.mts +222 -0
- package/dist/index-Nqm5_lwT.d.ts +188 -0
- package/dist/index-jBi3V6e5.d.mts +188 -0
- package/dist/index.d.mts +21 -729
- package/dist/index.d.ts +21 -729
- package/dist/index.js +3470 -97
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3457 -104
- package/dist/index.mjs.map +1 -1
- package/dist/server/configs/index.d.mts +602 -0
- package/dist/server/configs/index.d.ts +602 -0
- package/dist/server/configs/index.js +707 -0
- package/dist/server/configs/index.js.map +1 -0
- package/dist/server/configs/index.mjs +665 -0
- package/dist/server/configs/index.mjs.map +1 -0
- package/dist/server/index.d.mts +3 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +699 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +662 -1
- package/dist/server/index.mjs.map +1 -1
- package/dist/shared/config/index.d.mts +40 -0
- package/dist/shared/config/index.d.ts +40 -0
- package/dist/shared/config/index.js +58 -0
- package/dist/shared/config/index.js.map +1 -0
- package/dist/shared/config/index.mjs +51 -0
- package/dist/shared/config/index.mjs.map +1 -0
- package/dist/shared/constants/index.d.mts +593 -0
- package/dist/shared/constants/index.d.ts +593 -0
- package/dist/shared/constants/index.js +391 -0
- package/dist/shared/constants/index.js.map +1 -0
- package/dist/shared/constants/index.mjs +360 -0
- package/dist/shared/constants/index.mjs.map +1 -0
- package/dist/shared/index.d.mts +5 -1
- package/dist/shared/index.d.ts +5 -1
- package/dist/shared/types/index.d.mts +140 -0
- package/dist/shared/types/index.d.ts +140 -0
- package/dist/shared/types/index.js +4 -0
- package/dist/shared/types/index.js.map +1 -0
- package/dist/shared/types/index.mjs +3 -0
- package/dist/shared/types/index.mjs.map +1 -0
- package/dist/shared/utils/index.d.mts +255 -0
- package/dist/shared/utils/index.d.ts +255 -0
- package/dist/shared/utils/index.js +623 -0
- package/dist/shared/utils/index.js.map +1 -0
- package/dist/shared/utils/index.mjs +324 -0
- package/dist/shared/utils/index.mjs.map +1 -0
- package/dist/shared/validation/index.d.mts +258 -0
- package/dist/shared/validation/index.d.ts +258 -0
- package/dist/shared/validation/index.js +185 -0
- package/dist/shared/validation/index.js.map +1 -0
- package/dist/shared/validation/index.mjs +172 -0
- package/dist/shared/validation/index.mjs.map +1 -0
- package/package.json +151 -56
- package/dist/index-DEzgM15j.d.ts +0 -67
- package/dist/index-DNFVgQx8.d.ts +0 -1375
- package/dist/index-DbV04Dx8.d.mts +0 -67
- package/dist/index-DfqEP6Oe.d.mts +0 -1375
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
export { A as ApiErrorResponse, a as ApiResponse, b as ApiSuccessResponse, B as BaseFilterParams, C as CreateResponse, D as DeleteResponse, F as FilterWithPagination, G as GetResponse, L as ListResponse, P as PaginatedResponse, c as PaginationMeta, d as PaginationParams, U as UpdateResponse } from '../../response.types-D--UhLJq.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* User Types
|
|
5
|
+
*/
|
|
6
|
+
interface BaseUser {
|
|
7
|
+
id: string;
|
|
8
|
+
email: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
firstName?: string;
|
|
11
|
+
lastName?: string;
|
|
12
|
+
avatar?: string;
|
|
13
|
+
isActive?: boolean;
|
|
14
|
+
createdAt?: string | Date;
|
|
15
|
+
updatedAt?: string | Date;
|
|
16
|
+
}
|
|
17
|
+
interface UserWithRole extends BaseUser {
|
|
18
|
+
role: string | UserRole;
|
|
19
|
+
}
|
|
20
|
+
interface UserRole {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
permissions?: string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Authentication Types
|
|
27
|
+
*/
|
|
28
|
+
interface LoginCredentials {
|
|
29
|
+
email: string;
|
|
30
|
+
password: string;
|
|
31
|
+
}
|
|
32
|
+
interface RegisterCredentials extends LoginCredentials {
|
|
33
|
+
name?: string;
|
|
34
|
+
firstName?: string;
|
|
35
|
+
lastName?: string;
|
|
36
|
+
}
|
|
37
|
+
interface AuthTokens {
|
|
38
|
+
accessToken: string;
|
|
39
|
+
refreshToken?: string;
|
|
40
|
+
expiresIn?: number;
|
|
41
|
+
}
|
|
42
|
+
interface AuthResponse {
|
|
43
|
+
user: BaseUser;
|
|
44
|
+
tokens: AuthTokens;
|
|
45
|
+
}
|
|
46
|
+
interface JwtPayload {
|
|
47
|
+
userId: string;
|
|
48
|
+
email: string;
|
|
49
|
+
role?: string;
|
|
50
|
+
iat?: number;
|
|
51
|
+
exp?: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Password Reset Types
|
|
55
|
+
*/
|
|
56
|
+
interface ForgotPasswordRequest {
|
|
57
|
+
email: string;
|
|
58
|
+
}
|
|
59
|
+
interface ResetPasswordRequest {
|
|
60
|
+
token: string;
|
|
61
|
+
password: string;
|
|
62
|
+
confirmPassword: string;
|
|
63
|
+
}
|
|
64
|
+
interface ChangePasswordRequest {
|
|
65
|
+
currentPassword: string;
|
|
66
|
+
newPassword: string;
|
|
67
|
+
confirmPassword: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Common Entity Types
|
|
72
|
+
*/
|
|
73
|
+
interface BaseEntity {
|
|
74
|
+
id: string;
|
|
75
|
+
createdAt?: string | Date;
|
|
76
|
+
updatedAt?: string | Date;
|
|
77
|
+
}
|
|
78
|
+
interface SoftDeleteEntity extends BaseEntity {
|
|
79
|
+
deletedAt?: string | Date | null;
|
|
80
|
+
isDeleted?: boolean;
|
|
81
|
+
}
|
|
82
|
+
interface AuditableEntity extends BaseEntity {
|
|
83
|
+
createdBy?: string;
|
|
84
|
+
updatedBy?: string;
|
|
85
|
+
}
|
|
86
|
+
interface OrganizationEntity extends BaseEntity {
|
|
87
|
+
organizationId: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Timestamps
|
|
91
|
+
*/
|
|
92
|
+
interface Timestamps {
|
|
93
|
+
createdAt: string | Date;
|
|
94
|
+
updatedAt: string | Date;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Generic ID Types
|
|
98
|
+
*/
|
|
99
|
+
type ID = string;
|
|
100
|
+
type ObjectId = string;
|
|
101
|
+
/**
|
|
102
|
+
* Nullable Type Helper
|
|
103
|
+
*/
|
|
104
|
+
type Nullable<T> = T | null;
|
|
105
|
+
/**
|
|
106
|
+
* Optional Type Helper
|
|
107
|
+
*/
|
|
108
|
+
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
109
|
+
/**
|
|
110
|
+
* Required Type Helper
|
|
111
|
+
*/
|
|
112
|
+
type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;
|
|
113
|
+
/**
|
|
114
|
+
* Key-Value Pair
|
|
115
|
+
*/
|
|
116
|
+
interface KeyValuePair<T = string> {
|
|
117
|
+
key: string;
|
|
118
|
+
value: T;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Select Option (for dropdowns)
|
|
122
|
+
*/
|
|
123
|
+
interface SelectOption<T = string> {
|
|
124
|
+
label: string;
|
|
125
|
+
value: T;
|
|
126
|
+
disabled?: boolean;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Sort Order
|
|
130
|
+
*/
|
|
131
|
+
type SortOrder = 'asc' | 'desc';
|
|
132
|
+
/**
|
|
133
|
+
* Sort Config
|
|
134
|
+
*/
|
|
135
|
+
interface SortConfig {
|
|
136
|
+
field: string;
|
|
137
|
+
order: SortOrder;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export type { AuditableEntity, AuthResponse, AuthTokens, BaseEntity, BaseUser, ChangePasswordRequest, ForgotPasswordRequest, ID, JwtPayload, KeyValuePair, LoginCredentials, Nullable, ObjectId, Optional, OrganizationEntity, RegisterCredentials, RequiredFields, ResetPasswordRequest, SelectOption, SoftDeleteEntity, SortConfig, SortOrder, Timestamps, UserRole, UserWithRole };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
export { addDays, addHours, addMinutes, addMonths, addWeeks, addYears, differenceInDays, differenceInHours, differenceInMinutes, differenceInMonths, differenceInSeconds, differenceInWeeks, differenceInYears, eachDayOfInterval, eachMonthOfInterval, eachWeekOfInterval, endOfDay, endOfMonth, endOfWeek, endOfYear, format, formatDistance, formatDistanceToNow, formatDuration, formatRelative, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getYear, intervalToDuration, isAfter, isBefore, isEqual, isFuture, isPast, isSameDay, isSameMonth, isSameWeek, isSameYear, isThisMonth, isThisWeek, isThisYear, isToday, isTomorrow, isValid, isYesterday, parseISO, setHours, setMinutes, setSeconds, startOfDay, startOfMonth, startOfWeek, startOfYear, subDays, subHours, subMinutes, subMonths, subWeeks, subYears } from 'date-fns';
|
|
2
|
+
export { formatInTimeZone, fromZonedTime, toZonedTime } from 'date-fns-tz';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Enhanced Date/Time utilities using date-fns with timezone support
|
|
6
|
+
* Deep level date handling for all common operations
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Date input type - accepts Date, string (ISO), or timestamp
|
|
11
|
+
*/
|
|
12
|
+
type DateInput = Date | string | number;
|
|
13
|
+
/**
|
|
14
|
+
* Parse any date input to Date object
|
|
15
|
+
*/
|
|
16
|
+
declare const parseDate: (date: DateInput) => Date;
|
|
17
|
+
/**
|
|
18
|
+
* Check if date input is valid
|
|
19
|
+
*/
|
|
20
|
+
declare const isValidDate: (date: DateInput) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Format presets for common date formats
|
|
23
|
+
*/
|
|
24
|
+
declare const DATE_FORMATS: {
|
|
25
|
+
readonly DATE_SHORT: "MM/dd/yyyy";
|
|
26
|
+
readonly DATE_MEDIUM: "MMM d, yyyy";
|
|
27
|
+
readonly DATE_LONG: "MMMM d, yyyy";
|
|
28
|
+
readonly DATE_FULL: "EEEE, MMMM d, yyyy";
|
|
29
|
+
readonly DATE_ISO: "yyyy-MM-dd";
|
|
30
|
+
readonly TIME_SHORT: "h:mm a";
|
|
31
|
+
readonly TIME_MEDIUM: "h:mm:ss a";
|
|
32
|
+
readonly TIME_24H: "HH:mm";
|
|
33
|
+
readonly TIME_24H_FULL: "HH:mm:ss";
|
|
34
|
+
readonly DATETIME_SHORT: "MM/dd/yyyy h:mm a";
|
|
35
|
+
readonly DATETIME_MEDIUM: "MMM d, yyyy h:mm a";
|
|
36
|
+
readonly DATETIME_LONG: "MMMM d, yyyy h:mm a";
|
|
37
|
+
readonly DATETIME_FULL: "EEEE, MMMM d, yyyy h:mm a";
|
|
38
|
+
readonly DATETIME_ISO: "yyyy-MM-dd'T'HH:mm:ss";
|
|
39
|
+
readonly MONTH_YEAR: "MMMM yyyy";
|
|
40
|
+
readonly MONTH_DAY: "MMM d";
|
|
41
|
+
readonly DAY_MONTH: "d MMM";
|
|
42
|
+
readonly WEEKDAY: "EEEE";
|
|
43
|
+
readonly WEEKDAY_SHORT: "EEE";
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Format date with preset or custom format
|
|
47
|
+
*/
|
|
48
|
+
declare const formatDate: (date: DateInput, formatStr?: string) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Format date with time
|
|
51
|
+
*/
|
|
52
|
+
declare const formatDateTime: (date: DateInput, formatStr?: string) => string;
|
|
53
|
+
/**
|
|
54
|
+
* Format date in a specific timezone
|
|
55
|
+
*/
|
|
56
|
+
declare const formatDateInTimezone: (date: DateInput, timezone: string, formatStr?: string) => string;
|
|
57
|
+
/**
|
|
58
|
+
* Format date as relative time (e.g., "2 hours ago", "in 3 days")
|
|
59
|
+
*/
|
|
60
|
+
declare const formatRelativeTime: (date: DateInput, baseDate?: DateInput) => string;
|
|
61
|
+
/**
|
|
62
|
+
* Format date as smart relative (Today at 3:30 PM, Yesterday, etc.)
|
|
63
|
+
*/
|
|
64
|
+
declare const formatSmartDate: (date: DateInput) => string;
|
|
65
|
+
/**
|
|
66
|
+
* Format duration between two dates in human readable form
|
|
67
|
+
*/
|
|
68
|
+
declare const formatDateRange: (start: DateInput, end: DateInput) => string;
|
|
69
|
+
/**
|
|
70
|
+
* Convert date to a specific timezone
|
|
71
|
+
*/
|
|
72
|
+
declare const toTimezone: (date: DateInput, timezone: string) => Date;
|
|
73
|
+
/**
|
|
74
|
+
* Convert date from a specific timezone to UTC
|
|
75
|
+
*/
|
|
76
|
+
declare const fromTimezone: (date: DateInput, timezone: string) => Date;
|
|
77
|
+
/**
|
|
78
|
+
* Get current time in a specific timezone
|
|
79
|
+
*/
|
|
80
|
+
declare const nowInTimezone: (timezone: string) => Date;
|
|
81
|
+
/**
|
|
82
|
+
* Format time difference between timezones
|
|
83
|
+
*/
|
|
84
|
+
declare const getTimezoneDifference: (timezone1: string, timezone2: string) => string;
|
|
85
|
+
/**
|
|
86
|
+
* Add time to a date
|
|
87
|
+
*/
|
|
88
|
+
declare const addTime: (date: DateInput, amount: number, unit: "minutes" | "hours" | "days" | "weeks" | "months" | "years") => Date;
|
|
89
|
+
/**
|
|
90
|
+
* Subtract time from a date
|
|
91
|
+
*/
|
|
92
|
+
declare const subtractTime: (date: DateInput, amount: number, unit: "minutes" | "hours" | "days" | "weeks" | "months" | "years") => Date;
|
|
93
|
+
/**
|
|
94
|
+
* Get difference between two dates
|
|
95
|
+
*/
|
|
96
|
+
declare const getDateDifference: (date1: DateInput, date2: DateInput, unit: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months" | "years") => number;
|
|
97
|
+
/**
|
|
98
|
+
* Get all days in a range
|
|
99
|
+
*/
|
|
100
|
+
declare const getDaysInRange: (start: DateInput, end: DateInput) => Date[];
|
|
101
|
+
/**
|
|
102
|
+
* Get all weeks in a range
|
|
103
|
+
*/
|
|
104
|
+
declare const getWeeksInRange: (start: DateInput, end: DateInput) => Date[];
|
|
105
|
+
/**
|
|
106
|
+
* Get all months in a range
|
|
107
|
+
*/
|
|
108
|
+
declare const getMonthsInRange: (start: DateInput, end: DateInput) => Date[];
|
|
109
|
+
/**
|
|
110
|
+
* Get start and end of day
|
|
111
|
+
*/
|
|
112
|
+
declare const getDayBoundaries: (date: DateInput) => {
|
|
113
|
+
start: Date;
|
|
114
|
+
end: Date;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Get start and end of week
|
|
118
|
+
*/
|
|
119
|
+
declare const getWeekBoundaries: (date: DateInput, weekStartsOn?: 0 | 1) => {
|
|
120
|
+
start: Date;
|
|
121
|
+
end: Date;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Get start and end of month
|
|
125
|
+
*/
|
|
126
|
+
declare const getMonthBoundaries: (date: DateInput) => {
|
|
127
|
+
start: Date;
|
|
128
|
+
end: Date;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Get start and end of year
|
|
132
|
+
*/
|
|
133
|
+
declare const getYearBoundaries: (date: DateInput) => {
|
|
134
|
+
start: Date;
|
|
135
|
+
end: Date;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Check if date is between two dates (inclusive)
|
|
139
|
+
*/
|
|
140
|
+
declare const isDateBetween: (date: DateInput, start: DateInput, end: DateInput) => boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Check if two date ranges overlap
|
|
143
|
+
*/
|
|
144
|
+
declare const doDateRangesOverlap: (range1Start: DateInput, range1End: DateInput, range2Start: DateInput, range2End: DateInput) => boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Get age from birthdate
|
|
147
|
+
*/
|
|
148
|
+
declare const getAge: (birthDate: DateInput) => number;
|
|
149
|
+
/**
|
|
150
|
+
* Check if date is a weekend
|
|
151
|
+
*/
|
|
152
|
+
declare const isWeekend: (date: DateInput) => boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Check if date is a weekday
|
|
155
|
+
*/
|
|
156
|
+
declare const isWeekday: (date: DateInput) => boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Get days until a date
|
|
159
|
+
*/
|
|
160
|
+
declare const daysUntil: (date: DateInput) => number;
|
|
161
|
+
/**
|
|
162
|
+
* Get days since a date
|
|
163
|
+
*/
|
|
164
|
+
declare const daysSince: (date: DateInput) => number;
|
|
165
|
+
/**
|
|
166
|
+
* Format for HTML date input (yyyy-MM-dd)
|
|
167
|
+
*/
|
|
168
|
+
declare const toDateInputValue: (date: DateInput) => string;
|
|
169
|
+
/**
|
|
170
|
+
* Format for HTML datetime-local input
|
|
171
|
+
*/
|
|
172
|
+
declare const toDateTimeInputValue: (date: DateInput) => string;
|
|
173
|
+
/**
|
|
174
|
+
* Format for HTML time input (HH:mm)
|
|
175
|
+
*/
|
|
176
|
+
declare const toTimeInputValue: (date: DateInput) => string;
|
|
177
|
+
/**
|
|
178
|
+
* Set time on a date
|
|
179
|
+
*/
|
|
180
|
+
declare const setTime: (date: DateInput, hours: number, minutes: number, seconds?: number) => Date;
|
|
181
|
+
/**
|
|
182
|
+
* Combine date from one input and time from another
|
|
183
|
+
*/
|
|
184
|
+
declare const combineDateAndTime: (dateInput: DateInput, timeInput: DateInput) => Date;
|
|
185
|
+
declare const _default: {
|
|
186
|
+
parseDate: (date: DateInput) => Date;
|
|
187
|
+
isValidDate: (date: DateInput) => boolean;
|
|
188
|
+
DATE_FORMATS: {
|
|
189
|
+
readonly DATE_SHORT: "MM/dd/yyyy";
|
|
190
|
+
readonly DATE_MEDIUM: "MMM d, yyyy";
|
|
191
|
+
readonly DATE_LONG: "MMMM d, yyyy";
|
|
192
|
+
readonly DATE_FULL: "EEEE, MMMM d, yyyy";
|
|
193
|
+
readonly DATE_ISO: "yyyy-MM-dd";
|
|
194
|
+
readonly TIME_SHORT: "h:mm a";
|
|
195
|
+
readonly TIME_MEDIUM: "h:mm:ss a";
|
|
196
|
+
readonly TIME_24H: "HH:mm";
|
|
197
|
+
readonly TIME_24H_FULL: "HH:mm:ss";
|
|
198
|
+
readonly DATETIME_SHORT: "MM/dd/yyyy h:mm a";
|
|
199
|
+
readonly DATETIME_MEDIUM: "MMM d, yyyy h:mm a";
|
|
200
|
+
readonly DATETIME_LONG: "MMMM d, yyyy h:mm a";
|
|
201
|
+
readonly DATETIME_FULL: "EEEE, MMMM d, yyyy h:mm a";
|
|
202
|
+
readonly DATETIME_ISO: "yyyy-MM-dd'T'HH:mm:ss";
|
|
203
|
+
readonly MONTH_YEAR: "MMMM yyyy";
|
|
204
|
+
readonly MONTH_DAY: "MMM d";
|
|
205
|
+
readonly DAY_MONTH: "d MMM";
|
|
206
|
+
readonly WEEKDAY: "EEEE";
|
|
207
|
+
readonly WEEKDAY_SHORT: "EEE";
|
|
208
|
+
};
|
|
209
|
+
formatDate: (date: DateInput, formatStr?: string) => string;
|
|
210
|
+
formatDateTime: (date: DateInput, formatStr?: string) => string;
|
|
211
|
+
formatDateInTimezone: (date: DateInput, timezone: string, formatStr?: string) => string;
|
|
212
|
+
formatRelativeTime: (date: DateInput, baseDate?: DateInput) => string;
|
|
213
|
+
formatSmartDate: (date: DateInput) => string;
|
|
214
|
+
formatDateRange: (start: DateInput, end: DateInput) => string;
|
|
215
|
+
toTimezone: (date: DateInput, timezone: string) => Date;
|
|
216
|
+
fromTimezone: (date: DateInput, timezone: string) => Date;
|
|
217
|
+
nowInTimezone: (timezone: string) => Date;
|
|
218
|
+
getTimezoneDifference: (timezone1: string, timezone2: string) => string;
|
|
219
|
+
addTime: (date: DateInput, amount: number, unit: "minutes" | "hours" | "days" | "weeks" | "months" | "years") => Date;
|
|
220
|
+
subtractTime: (date: DateInput, amount: number, unit: "minutes" | "hours" | "days" | "weeks" | "months" | "years") => Date;
|
|
221
|
+
getDateDifference: (date1: DateInput, date2: DateInput, unit: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months" | "years") => number;
|
|
222
|
+
getDaysInRange: (start: DateInput, end: DateInput) => Date[];
|
|
223
|
+
getWeeksInRange: (start: DateInput, end: DateInput) => Date[];
|
|
224
|
+
getMonthsInRange: (start: DateInput, end: DateInput) => Date[];
|
|
225
|
+
getDayBoundaries: (date: DateInput) => {
|
|
226
|
+
start: Date;
|
|
227
|
+
end: Date;
|
|
228
|
+
};
|
|
229
|
+
getWeekBoundaries: (date: DateInput, weekStartsOn?: 0 | 1) => {
|
|
230
|
+
start: Date;
|
|
231
|
+
end: Date;
|
|
232
|
+
};
|
|
233
|
+
getMonthBoundaries: (date: DateInput) => {
|
|
234
|
+
start: Date;
|
|
235
|
+
end: Date;
|
|
236
|
+
};
|
|
237
|
+
getYearBoundaries: (date: DateInput) => {
|
|
238
|
+
start: Date;
|
|
239
|
+
end: Date;
|
|
240
|
+
};
|
|
241
|
+
isDateBetween: (date: DateInput, start: DateInput, end: DateInput) => boolean;
|
|
242
|
+
doDateRangesOverlap: (range1Start: DateInput, range1End: DateInput, range2Start: DateInput, range2End: DateInput) => boolean;
|
|
243
|
+
getAge: (birthDate: DateInput) => number;
|
|
244
|
+
isWeekend: (date: DateInput) => boolean;
|
|
245
|
+
isWeekday: (date: DateInput) => boolean;
|
|
246
|
+
daysUntil: (date: DateInput) => number;
|
|
247
|
+
daysSince: (date: DateInput) => number;
|
|
248
|
+
toDateInputValue: (date: DateInput) => string;
|
|
249
|
+
toDateTimeInputValue: (date: DateInput) => string;
|
|
250
|
+
toTimeInputValue: (date: DateInput) => string;
|
|
251
|
+
setTime: (date: DateInput, hours: number, minutes: number, seconds?: number) => Date;
|
|
252
|
+
combineDateAndTime: (dateInput: DateInput, timeInput: DateInput) => Date;
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export { DATE_FORMATS, type DateInput, addTime, combineDateAndTime, _default as dateTime, daysSince, daysUntil, doDateRangesOverlap, formatDate, formatDateInTimezone, formatDateRange, formatDateTime, formatRelativeTime, formatSmartDate, fromTimezone, getAge, getDateDifference, getDayBoundaries, getDaysInRange, getMonthBoundaries, getMonthsInRange, getTimezoneDifference, getWeekBoundaries, getWeeksInRange, getYearBoundaries, isDateBetween, isValidDate, isWeekday, isWeekend, nowInTimezone, parseDate, setTime, subtractTime, toDateInputValue, toDateTimeInputValue, toTimeInputValue, toTimezone };
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
export { addDays, addHours, addMinutes, addMonths, addWeeks, addYears, differenceInDays, differenceInHours, differenceInMinutes, differenceInMonths, differenceInSeconds, differenceInWeeks, differenceInYears, eachDayOfInterval, eachMonthOfInterval, eachWeekOfInterval, endOfDay, endOfMonth, endOfWeek, endOfYear, format, formatDistance, formatDistanceToNow, formatDuration, formatRelative, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getYear, intervalToDuration, isAfter, isBefore, isEqual, isFuture, isPast, isSameDay, isSameMonth, isSameWeek, isSameYear, isThisMonth, isThisWeek, isThisYear, isToday, isTomorrow, isValid, isYesterday, parseISO, setHours, setMinutes, setSeconds, startOfDay, startOfMonth, startOfWeek, startOfYear, subDays, subHours, subMinutes, subMonths, subWeeks, subYears } from 'date-fns';
|
|
2
|
+
export { formatInTimeZone, fromZonedTime, toZonedTime } from 'date-fns-tz';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Enhanced Date/Time utilities using date-fns with timezone support
|
|
6
|
+
* Deep level date handling for all common operations
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Date input type - accepts Date, string (ISO), or timestamp
|
|
11
|
+
*/
|
|
12
|
+
type DateInput = Date | string | number;
|
|
13
|
+
/**
|
|
14
|
+
* Parse any date input to Date object
|
|
15
|
+
*/
|
|
16
|
+
declare const parseDate: (date: DateInput) => Date;
|
|
17
|
+
/**
|
|
18
|
+
* Check if date input is valid
|
|
19
|
+
*/
|
|
20
|
+
declare const isValidDate: (date: DateInput) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Format presets for common date formats
|
|
23
|
+
*/
|
|
24
|
+
declare const DATE_FORMATS: {
|
|
25
|
+
readonly DATE_SHORT: "MM/dd/yyyy";
|
|
26
|
+
readonly DATE_MEDIUM: "MMM d, yyyy";
|
|
27
|
+
readonly DATE_LONG: "MMMM d, yyyy";
|
|
28
|
+
readonly DATE_FULL: "EEEE, MMMM d, yyyy";
|
|
29
|
+
readonly DATE_ISO: "yyyy-MM-dd";
|
|
30
|
+
readonly TIME_SHORT: "h:mm a";
|
|
31
|
+
readonly TIME_MEDIUM: "h:mm:ss a";
|
|
32
|
+
readonly TIME_24H: "HH:mm";
|
|
33
|
+
readonly TIME_24H_FULL: "HH:mm:ss";
|
|
34
|
+
readonly DATETIME_SHORT: "MM/dd/yyyy h:mm a";
|
|
35
|
+
readonly DATETIME_MEDIUM: "MMM d, yyyy h:mm a";
|
|
36
|
+
readonly DATETIME_LONG: "MMMM d, yyyy h:mm a";
|
|
37
|
+
readonly DATETIME_FULL: "EEEE, MMMM d, yyyy h:mm a";
|
|
38
|
+
readonly DATETIME_ISO: "yyyy-MM-dd'T'HH:mm:ss";
|
|
39
|
+
readonly MONTH_YEAR: "MMMM yyyy";
|
|
40
|
+
readonly MONTH_DAY: "MMM d";
|
|
41
|
+
readonly DAY_MONTH: "d MMM";
|
|
42
|
+
readonly WEEKDAY: "EEEE";
|
|
43
|
+
readonly WEEKDAY_SHORT: "EEE";
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Format date with preset or custom format
|
|
47
|
+
*/
|
|
48
|
+
declare const formatDate: (date: DateInput, formatStr?: string) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Format date with time
|
|
51
|
+
*/
|
|
52
|
+
declare const formatDateTime: (date: DateInput, formatStr?: string) => string;
|
|
53
|
+
/**
|
|
54
|
+
* Format date in a specific timezone
|
|
55
|
+
*/
|
|
56
|
+
declare const formatDateInTimezone: (date: DateInput, timezone: string, formatStr?: string) => string;
|
|
57
|
+
/**
|
|
58
|
+
* Format date as relative time (e.g., "2 hours ago", "in 3 days")
|
|
59
|
+
*/
|
|
60
|
+
declare const formatRelativeTime: (date: DateInput, baseDate?: DateInput) => string;
|
|
61
|
+
/**
|
|
62
|
+
* Format date as smart relative (Today at 3:30 PM, Yesterday, etc.)
|
|
63
|
+
*/
|
|
64
|
+
declare const formatSmartDate: (date: DateInput) => string;
|
|
65
|
+
/**
|
|
66
|
+
* Format duration between two dates in human readable form
|
|
67
|
+
*/
|
|
68
|
+
declare const formatDateRange: (start: DateInput, end: DateInput) => string;
|
|
69
|
+
/**
|
|
70
|
+
* Convert date to a specific timezone
|
|
71
|
+
*/
|
|
72
|
+
declare const toTimezone: (date: DateInput, timezone: string) => Date;
|
|
73
|
+
/**
|
|
74
|
+
* Convert date from a specific timezone to UTC
|
|
75
|
+
*/
|
|
76
|
+
declare const fromTimezone: (date: DateInput, timezone: string) => Date;
|
|
77
|
+
/**
|
|
78
|
+
* Get current time in a specific timezone
|
|
79
|
+
*/
|
|
80
|
+
declare const nowInTimezone: (timezone: string) => Date;
|
|
81
|
+
/**
|
|
82
|
+
* Format time difference between timezones
|
|
83
|
+
*/
|
|
84
|
+
declare const getTimezoneDifference: (timezone1: string, timezone2: string) => string;
|
|
85
|
+
/**
|
|
86
|
+
* Add time to a date
|
|
87
|
+
*/
|
|
88
|
+
declare const addTime: (date: DateInput, amount: number, unit: "minutes" | "hours" | "days" | "weeks" | "months" | "years") => Date;
|
|
89
|
+
/**
|
|
90
|
+
* Subtract time from a date
|
|
91
|
+
*/
|
|
92
|
+
declare const subtractTime: (date: DateInput, amount: number, unit: "minutes" | "hours" | "days" | "weeks" | "months" | "years") => Date;
|
|
93
|
+
/**
|
|
94
|
+
* Get difference between two dates
|
|
95
|
+
*/
|
|
96
|
+
declare const getDateDifference: (date1: DateInput, date2: DateInput, unit: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months" | "years") => number;
|
|
97
|
+
/**
|
|
98
|
+
* Get all days in a range
|
|
99
|
+
*/
|
|
100
|
+
declare const getDaysInRange: (start: DateInput, end: DateInput) => Date[];
|
|
101
|
+
/**
|
|
102
|
+
* Get all weeks in a range
|
|
103
|
+
*/
|
|
104
|
+
declare const getWeeksInRange: (start: DateInput, end: DateInput) => Date[];
|
|
105
|
+
/**
|
|
106
|
+
* Get all months in a range
|
|
107
|
+
*/
|
|
108
|
+
declare const getMonthsInRange: (start: DateInput, end: DateInput) => Date[];
|
|
109
|
+
/**
|
|
110
|
+
* Get start and end of day
|
|
111
|
+
*/
|
|
112
|
+
declare const getDayBoundaries: (date: DateInput) => {
|
|
113
|
+
start: Date;
|
|
114
|
+
end: Date;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Get start and end of week
|
|
118
|
+
*/
|
|
119
|
+
declare const getWeekBoundaries: (date: DateInput, weekStartsOn?: 0 | 1) => {
|
|
120
|
+
start: Date;
|
|
121
|
+
end: Date;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Get start and end of month
|
|
125
|
+
*/
|
|
126
|
+
declare const getMonthBoundaries: (date: DateInput) => {
|
|
127
|
+
start: Date;
|
|
128
|
+
end: Date;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Get start and end of year
|
|
132
|
+
*/
|
|
133
|
+
declare const getYearBoundaries: (date: DateInput) => {
|
|
134
|
+
start: Date;
|
|
135
|
+
end: Date;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Check if date is between two dates (inclusive)
|
|
139
|
+
*/
|
|
140
|
+
declare const isDateBetween: (date: DateInput, start: DateInput, end: DateInput) => boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Check if two date ranges overlap
|
|
143
|
+
*/
|
|
144
|
+
declare const doDateRangesOverlap: (range1Start: DateInput, range1End: DateInput, range2Start: DateInput, range2End: DateInput) => boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Get age from birthdate
|
|
147
|
+
*/
|
|
148
|
+
declare const getAge: (birthDate: DateInput) => number;
|
|
149
|
+
/**
|
|
150
|
+
* Check if date is a weekend
|
|
151
|
+
*/
|
|
152
|
+
declare const isWeekend: (date: DateInput) => boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Check if date is a weekday
|
|
155
|
+
*/
|
|
156
|
+
declare const isWeekday: (date: DateInput) => boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Get days until a date
|
|
159
|
+
*/
|
|
160
|
+
declare const daysUntil: (date: DateInput) => number;
|
|
161
|
+
/**
|
|
162
|
+
* Get days since a date
|
|
163
|
+
*/
|
|
164
|
+
declare const daysSince: (date: DateInput) => number;
|
|
165
|
+
/**
|
|
166
|
+
* Format for HTML date input (yyyy-MM-dd)
|
|
167
|
+
*/
|
|
168
|
+
declare const toDateInputValue: (date: DateInput) => string;
|
|
169
|
+
/**
|
|
170
|
+
* Format for HTML datetime-local input
|
|
171
|
+
*/
|
|
172
|
+
declare const toDateTimeInputValue: (date: DateInput) => string;
|
|
173
|
+
/**
|
|
174
|
+
* Format for HTML time input (HH:mm)
|
|
175
|
+
*/
|
|
176
|
+
declare const toTimeInputValue: (date: DateInput) => string;
|
|
177
|
+
/**
|
|
178
|
+
* Set time on a date
|
|
179
|
+
*/
|
|
180
|
+
declare const setTime: (date: DateInput, hours: number, minutes: number, seconds?: number) => Date;
|
|
181
|
+
/**
|
|
182
|
+
* Combine date from one input and time from another
|
|
183
|
+
*/
|
|
184
|
+
declare const combineDateAndTime: (dateInput: DateInput, timeInput: DateInput) => Date;
|
|
185
|
+
declare const _default: {
|
|
186
|
+
parseDate: (date: DateInput) => Date;
|
|
187
|
+
isValidDate: (date: DateInput) => boolean;
|
|
188
|
+
DATE_FORMATS: {
|
|
189
|
+
readonly DATE_SHORT: "MM/dd/yyyy";
|
|
190
|
+
readonly DATE_MEDIUM: "MMM d, yyyy";
|
|
191
|
+
readonly DATE_LONG: "MMMM d, yyyy";
|
|
192
|
+
readonly DATE_FULL: "EEEE, MMMM d, yyyy";
|
|
193
|
+
readonly DATE_ISO: "yyyy-MM-dd";
|
|
194
|
+
readonly TIME_SHORT: "h:mm a";
|
|
195
|
+
readonly TIME_MEDIUM: "h:mm:ss a";
|
|
196
|
+
readonly TIME_24H: "HH:mm";
|
|
197
|
+
readonly TIME_24H_FULL: "HH:mm:ss";
|
|
198
|
+
readonly DATETIME_SHORT: "MM/dd/yyyy h:mm a";
|
|
199
|
+
readonly DATETIME_MEDIUM: "MMM d, yyyy h:mm a";
|
|
200
|
+
readonly DATETIME_LONG: "MMMM d, yyyy h:mm a";
|
|
201
|
+
readonly DATETIME_FULL: "EEEE, MMMM d, yyyy h:mm a";
|
|
202
|
+
readonly DATETIME_ISO: "yyyy-MM-dd'T'HH:mm:ss";
|
|
203
|
+
readonly MONTH_YEAR: "MMMM yyyy";
|
|
204
|
+
readonly MONTH_DAY: "MMM d";
|
|
205
|
+
readonly DAY_MONTH: "d MMM";
|
|
206
|
+
readonly WEEKDAY: "EEEE";
|
|
207
|
+
readonly WEEKDAY_SHORT: "EEE";
|
|
208
|
+
};
|
|
209
|
+
formatDate: (date: DateInput, formatStr?: string) => string;
|
|
210
|
+
formatDateTime: (date: DateInput, formatStr?: string) => string;
|
|
211
|
+
formatDateInTimezone: (date: DateInput, timezone: string, formatStr?: string) => string;
|
|
212
|
+
formatRelativeTime: (date: DateInput, baseDate?: DateInput) => string;
|
|
213
|
+
formatSmartDate: (date: DateInput) => string;
|
|
214
|
+
formatDateRange: (start: DateInput, end: DateInput) => string;
|
|
215
|
+
toTimezone: (date: DateInput, timezone: string) => Date;
|
|
216
|
+
fromTimezone: (date: DateInput, timezone: string) => Date;
|
|
217
|
+
nowInTimezone: (timezone: string) => Date;
|
|
218
|
+
getTimezoneDifference: (timezone1: string, timezone2: string) => string;
|
|
219
|
+
addTime: (date: DateInput, amount: number, unit: "minutes" | "hours" | "days" | "weeks" | "months" | "years") => Date;
|
|
220
|
+
subtractTime: (date: DateInput, amount: number, unit: "minutes" | "hours" | "days" | "weeks" | "months" | "years") => Date;
|
|
221
|
+
getDateDifference: (date1: DateInput, date2: DateInput, unit: "seconds" | "minutes" | "hours" | "days" | "weeks" | "months" | "years") => number;
|
|
222
|
+
getDaysInRange: (start: DateInput, end: DateInput) => Date[];
|
|
223
|
+
getWeeksInRange: (start: DateInput, end: DateInput) => Date[];
|
|
224
|
+
getMonthsInRange: (start: DateInput, end: DateInput) => Date[];
|
|
225
|
+
getDayBoundaries: (date: DateInput) => {
|
|
226
|
+
start: Date;
|
|
227
|
+
end: Date;
|
|
228
|
+
};
|
|
229
|
+
getWeekBoundaries: (date: DateInput, weekStartsOn?: 0 | 1) => {
|
|
230
|
+
start: Date;
|
|
231
|
+
end: Date;
|
|
232
|
+
};
|
|
233
|
+
getMonthBoundaries: (date: DateInput) => {
|
|
234
|
+
start: Date;
|
|
235
|
+
end: Date;
|
|
236
|
+
};
|
|
237
|
+
getYearBoundaries: (date: DateInput) => {
|
|
238
|
+
start: Date;
|
|
239
|
+
end: Date;
|
|
240
|
+
};
|
|
241
|
+
isDateBetween: (date: DateInput, start: DateInput, end: DateInput) => boolean;
|
|
242
|
+
doDateRangesOverlap: (range1Start: DateInput, range1End: DateInput, range2Start: DateInput, range2End: DateInput) => boolean;
|
|
243
|
+
getAge: (birthDate: DateInput) => number;
|
|
244
|
+
isWeekend: (date: DateInput) => boolean;
|
|
245
|
+
isWeekday: (date: DateInput) => boolean;
|
|
246
|
+
daysUntil: (date: DateInput) => number;
|
|
247
|
+
daysSince: (date: DateInput) => number;
|
|
248
|
+
toDateInputValue: (date: DateInput) => string;
|
|
249
|
+
toDateTimeInputValue: (date: DateInput) => string;
|
|
250
|
+
toTimeInputValue: (date: DateInput) => string;
|
|
251
|
+
setTime: (date: DateInput, hours: number, minutes: number, seconds?: number) => Date;
|
|
252
|
+
combineDateAndTime: (dateInput: DateInput, timeInput: DateInput) => Date;
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export { DATE_FORMATS, type DateInput, addTime, combineDateAndTime, _default as dateTime, daysSince, daysUntil, doDateRangesOverlap, formatDate, formatDateInTimezone, formatDateRange, formatDateTime, formatRelativeTime, formatSmartDate, fromTimezone, getAge, getDateDifference, getDayBoundaries, getDaysInRange, getMonthBoundaries, getMonthsInRange, getTimezoneDifference, getWeekBoundaries, getWeeksInRange, getYearBoundaries, isDateBetween, isValidDate, isWeekday, isWeekend, nowInTimezone, parseDate, setTime, subtractTime, toDateInputValue, toDateTimeInputValue, toTimeInputValue, toTimezone };
|