@gzl10/ts-helpers 4.2.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/CHANGELOG.md +320 -0
- package/README.md +233 -0
- package/USAGE-GUIDE.md +800 -0
- package/dist/browser/async.js +15 -0
- package/dist/browser/async.js.map +1 -0
- package/dist/browser/chunk-4O7ZPIJN.js +383 -0
- package/dist/browser/chunk-4O7ZPIJN.js.map +1 -0
- package/dist/browser/chunk-75XNTC34.js +60 -0
- package/dist/browser/chunk-75XNTC34.js.map +1 -0
- package/dist/browser/chunk-C3D7YZVE.js +299 -0
- package/dist/browser/chunk-C3D7YZVE.js.map +1 -0
- package/dist/browser/chunk-CZL6C2EI.js +452 -0
- package/dist/browser/chunk-CZL6C2EI.js.map +1 -0
- package/dist/browser/chunk-D4FZFIVA.js +240 -0
- package/dist/browser/chunk-D4FZFIVA.js.map +1 -0
- package/dist/browser/chunk-IL7NG7IC.js +72 -0
- package/dist/browser/chunk-IL7NG7IC.js.map +1 -0
- package/dist/browser/chunk-NSBPE2FW.js +17 -0
- package/dist/browser/chunk-NSBPE2FW.js.map +1 -0
- package/dist/browser/chunk-SLQVNPTH.js +27 -0
- package/dist/browser/chunk-SLQVNPTH.js.map +1 -0
- package/dist/browser/chunk-WG7ILCUB.js +195 -0
- package/dist/browser/chunk-WG7ILCUB.js.map +1 -0
- package/dist/browser/chunk-WJA4JDMZ.js +278 -0
- package/dist/browser/chunk-WJA4JDMZ.js.map +1 -0
- package/dist/browser/chunk-ZFVYLUTT.js +65 -0
- package/dist/browser/chunk-ZFVYLUTT.js.map +1 -0
- package/dist/browser/chunk-ZYTSVMTI.js +263 -0
- package/dist/browser/chunk-ZYTSVMTI.js.map +1 -0
- package/dist/browser/dates.js +78 -0
- package/dist/browser/dates.js.map +1 -0
- package/dist/browser/environment-detection.js +21 -0
- package/dist/browser/environment-detection.js.map +1 -0
- package/dist/browser/environment.js +34 -0
- package/dist/browser/environment.js.map +1 -0
- package/dist/browser/errors.js +18 -0
- package/dist/browser/errors.js.map +1 -0
- package/dist/browser/index.js +412 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/math.js +51 -0
- package/dist/browser/math.js.map +1 -0
- package/dist/browser/number.js +10 -0
- package/dist/browser/number.js.map +1 -0
- package/dist/browser/objects.js +31 -0
- package/dist/browser/objects.js.map +1 -0
- package/dist/browser/strings.js +80 -0
- package/dist/browser/strings.js.map +1 -0
- package/dist/browser/validation-core.js +54 -0
- package/dist/browser/validation-core.js.map +1 -0
- package/dist/browser/validation-crypto.js +28 -0
- package/dist/browser/validation-crypto.js.map +1 -0
- package/dist/browser/validators.js +98 -0
- package/dist/browser/validators.js.map +1 -0
- package/dist/cjs/async.js +86 -0
- package/dist/cjs/async.js.map +1 -0
- package/dist/cjs/dates.js +285 -0
- package/dist/cjs/dates.js.map +1 -0
- package/dist/cjs/environment-detection.js +84 -0
- package/dist/cjs/environment-detection.js.map +1 -0
- package/dist/cjs/environment.js +261 -0
- package/dist/cjs/environment.js.map +1 -0
- package/dist/cjs/errors.js +80 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/index.js +2035 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/math.js +388 -0
- package/dist/cjs/math.js.map +1 -0
- package/dist/cjs/number.js +37 -0
- package/dist/cjs/number.js.map +1 -0
- package/dist/cjs/objects.js +249 -0
- package/dist/cjs/objects.js.map +1 -0
- package/dist/cjs/strings.js +253 -0
- package/dist/cjs/strings.js.map +1 -0
- package/dist/cjs/validation.js +450 -0
- package/dist/cjs/validation.js.map +1 -0
- package/dist/esm/async.js +15 -0
- package/dist/esm/async.js.map +1 -0
- package/dist/esm/chunk-4O7ZPIJN.js +383 -0
- package/dist/esm/chunk-4O7ZPIJN.js.map +1 -0
- package/dist/esm/chunk-75XNTC34.js +60 -0
- package/dist/esm/chunk-75XNTC34.js.map +1 -0
- package/dist/esm/chunk-BDOBKBKA.js +72 -0
- package/dist/esm/chunk-BDOBKBKA.js.map +1 -0
- package/dist/esm/chunk-C3D7YZVE.js +299 -0
- package/dist/esm/chunk-C3D7YZVE.js.map +1 -0
- package/dist/esm/chunk-CZL6C2EI.js +452 -0
- package/dist/esm/chunk-CZL6C2EI.js.map +1 -0
- package/dist/esm/chunk-EBLSTOEC.js +263 -0
- package/dist/esm/chunk-EBLSTOEC.js.map +1 -0
- package/dist/esm/chunk-NSBPE2FW.js +17 -0
- package/dist/esm/chunk-NSBPE2FW.js.map +1 -0
- package/dist/esm/chunk-SLQVNPTH.js +27 -0
- package/dist/esm/chunk-SLQVNPTH.js.map +1 -0
- package/dist/esm/chunk-WG7ILCUB.js +195 -0
- package/dist/esm/chunk-WG7ILCUB.js.map +1 -0
- package/dist/esm/chunk-WJA4JDMZ.js +278 -0
- package/dist/esm/chunk-WJA4JDMZ.js.map +1 -0
- package/dist/esm/chunk-ZFVYLUTT.js +65 -0
- package/dist/esm/chunk-ZFVYLUTT.js.map +1 -0
- package/dist/esm/dates.js +78 -0
- package/dist/esm/dates.js.map +1 -0
- package/dist/esm/environment-detection.js +21 -0
- package/dist/esm/environment-detection.js.map +1 -0
- package/dist/esm/environment.js +34 -0
- package/dist/esm/environment.js.map +1 -0
- package/dist/esm/errors.js +18 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/index.js +380 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/math.js +51 -0
- package/dist/esm/math.js.map +1 -0
- package/dist/esm/number.js +10 -0
- package/dist/esm/number.js.map +1 -0
- package/dist/esm/objects.js +31 -0
- package/dist/esm/objects.js.map +1 -0
- package/dist/esm/strings.js +80 -0
- package/dist/esm/strings.js.map +1 -0
- package/dist/esm/validation.js +54 -0
- package/dist/esm/validation.js.map +1 -0
- package/dist/node/async.js +93 -0
- package/dist/node/async.js.map +1 -0
- package/dist/node/csv.js +102 -0
- package/dist/node/csv.js.map +1 -0
- package/dist/node/data.js +880 -0
- package/dist/node/data.js.map +1 -0
- package/dist/node/dates.js +324 -0
- package/dist/node/dates.js.map +1 -0
- package/dist/node/environment.js +278 -0
- package/dist/node/environment.js.map +1 -0
- package/dist/node/errors.js +89 -0
- package/dist/node/errors.js.map +1 -0
- package/dist/node/index.js +3151 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/json.js +107 -0
- package/dist/node/json.js.map +1 -0
- package/dist/node/math.js +413 -0
- package/dist/node/math.js.map +1 -0
- package/dist/node/number.js +42 -0
- package/dist/node/number.js.map +1 -0
- package/dist/node/objects.js +264 -0
- package/dist/node/objects.js.map +1 -0
- package/dist/node/strings.js +293 -0
- package/dist/node/strings.js.map +1 -0
- package/dist/node/tree.js +89 -0
- package/dist/node/tree.js.map +1 -0
- package/dist/node/validation-core.js +477 -0
- package/dist/node/validation-core.js.map +1 -0
- package/dist/node/validation-crypto.js +179 -0
- package/dist/node/validation-crypto.js.map +1 -0
- package/dist/node/validation.js +677 -0
- package/dist/node/validation.js.map +1 -0
- package/dist/node/validators.js +123 -0
- package/dist/node/validators.js.map +1 -0
- package/dist/node-esm/async.js +15 -0
- package/dist/node-esm/async.js.map +1 -0
- package/dist/node-esm/chunk-3YOF7NPT.js +299 -0
- package/dist/node-esm/chunk-3YOF7NPT.js.map +1 -0
- package/dist/node-esm/chunk-64TBXJQS.js +263 -0
- package/dist/node-esm/chunk-64TBXJQS.js.map +1 -0
- package/dist/node-esm/chunk-75XNTC34.js +60 -0
- package/dist/node-esm/chunk-75XNTC34.js.map +1 -0
- package/dist/node-esm/chunk-C4PKXIPB.js +278 -0
- package/dist/node-esm/chunk-C4PKXIPB.js.map +1 -0
- package/dist/node-esm/chunk-CMDFZME3.js +452 -0
- package/dist/node-esm/chunk-CMDFZME3.js.map +1 -0
- package/dist/node-esm/chunk-DZZPUYMP.js +74 -0
- package/dist/node-esm/chunk-DZZPUYMP.js.map +1 -0
- package/dist/node-esm/chunk-HTSEHRHI.js +195 -0
- package/dist/node-esm/chunk-HTSEHRHI.js.map +1 -0
- package/dist/node-esm/chunk-JCAUVOPH.js +27 -0
- package/dist/node-esm/chunk-JCAUVOPH.js.map +1 -0
- package/dist/node-esm/chunk-KBHE3K2F.js +505 -0
- package/dist/node-esm/chunk-KBHE3K2F.js.map +1 -0
- package/dist/node-esm/chunk-LYTET5NX.js +65 -0
- package/dist/node-esm/chunk-LYTET5NX.js.map +1 -0
- package/dist/node-esm/chunk-PZ5AY32C.js +10 -0
- package/dist/node-esm/chunk-PZ5AY32C.js.map +1 -0
- package/dist/node-esm/chunk-UKGXL2QO.js +383 -0
- package/dist/node-esm/chunk-UKGXL2QO.js.map +1 -0
- package/dist/node-esm/chunk-XAEYT23H.js +164 -0
- package/dist/node-esm/chunk-XAEYT23H.js.map +1 -0
- package/dist/node-esm/csv.js +63 -0
- package/dist/node-esm/csv.js.map +1 -0
- package/dist/node-esm/data.js +32 -0
- package/dist/node-esm/data.js.map +1 -0
- package/dist/node-esm/dates.js +78 -0
- package/dist/node-esm/dates.js.map +1 -0
- package/dist/node-esm/environment.js +34 -0
- package/dist/node-esm/environment.js.map +1 -0
- package/dist/node-esm/errors.js +18 -0
- package/dist/node-esm/errors.js.map +1 -0
- package/dist/node-esm/index.js +426 -0
- package/dist/node-esm/index.js.map +1 -0
- package/dist/node-esm/json.js +68 -0
- package/dist/node-esm/json.js.map +1 -0
- package/dist/node-esm/math.js +51 -0
- package/dist/node-esm/math.js.map +1 -0
- package/dist/node-esm/number.js +10 -0
- package/dist/node-esm/number.js.map +1 -0
- package/dist/node-esm/objects.js +31 -0
- package/dist/node-esm/objects.js.map +1 -0
- package/dist/node-esm/strings.js +80 -0
- package/dist/node-esm/strings.js.map +1 -0
- package/dist/node-esm/tree.js +8 -0
- package/dist/node-esm/tree.js.map +1 -0
- package/dist/node-esm/validation-core.js +54 -0
- package/dist/node-esm/validation-core.js.map +1 -0
- package/dist/node-esm/validation-crypto.js +26 -0
- package/dist/node-esm/validation-crypto.js.map +1 -0
- package/dist/node-esm/validation.js +606 -0
- package/dist/node-esm/validation.js.map +1 -0
- package/dist/node-esm/validators.js +98 -0
- package/dist/node-esm/validators.js.map +1 -0
- package/dist/types/async-C8gvbSG-.d.ts +453 -0
- package/dist/types/async.d.ts +1 -0
- package/dist/types/csv.d.ts +226 -0
- package/dist/types/data.d.ts +1561 -0
- package/dist/types/dates-hTiE0Z11.d.ts +298 -0
- package/dist/types/dates.d.ts +1 -0
- package/dist/types/environment-B8eLS7KT.d.ts +420 -0
- package/dist/types/environment-detection.d.ts +102 -0
- package/dist/types/environment.d.ts +1 -0
- package/dist/types/errors.d.ts +147 -0
- package/dist/types/index.d.ts +211 -0
- package/dist/types/json.d.ts +284 -0
- package/dist/types/math-BQ9Lwdp7.d.ts +2060 -0
- package/dist/types/math.d.ts +1 -0
- package/dist/types/number-CYnQfLWj.d.ts +44 -0
- package/dist/types/number.d.ts +1 -0
- package/dist/types/objects-BohS8GCS.d.ts +1185 -0
- package/dist/types/objects.d.ts +1 -0
- package/dist/types/strings-CiqRPYLL.d.ts +1349 -0
- package/dist/types/strings.d.ts +1 -0
- package/dist/types/tree.d.ts +284 -0
- package/dist/types/validation-core-DfHF8rCG.d.ts +238 -0
- package/dist/types/validation-crypto-browser.d.ts +56 -0
- package/dist/types/validation-crypto-node.d.ts +31 -0
- package/dist/types/validation.d.ts +1 -0
- package/dist/types/validators.d.ts +216 -0
- package/package.json +253 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Date manipulation and formatting utilities
|
|
3
|
+
* Consolidated from specialized/date module
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Formats current date with specified format
|
|
8
|
+
*/
|
|
9
|
+
declare const formatNow: (formatStr?: string) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Formats date with specified format string (Spanish locale by default)
|
|
12
|
+
*
|
|
13
|
+
* Flexible date formatter with special support for week-of-year formats.
|
|
14
|
+
* Uses dayjs Spanish locale for month/day names.
|
|
15
|
+
*
|
|
16
|
+
* @param value - Date value to format (Date, string, timestamp, dayjs)
|
|
17
|
+
* @param formatStr - Format string (default: 'DD/MM/YYYY' for Spanish dates)
|
|
18
|
+
* @returns Formatted date string, empty string if value is null/undefined
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const date = new Date('2024-03-15')
|
|
23
|
+
*
|
|
24
|
+
* format(date) // '15/03/2024' (Spanish default)
|
|
25
|
+
* format(date, 'DD-MM-YYYY') // '15-03-2024'
|
|
26
|
+
* format(date, 'YYYY/MM/DD') // '2024/03/15'
|
|
27
|
+
* format(date, 'DD MMM YYYY') // '15 mar 2024' (Spanish month)
|
|
28
|
+
* format(date, 'dddd, DD MMMM') // 'viernes, 15 marzo' (Spanish)
|
|
29
|
+
* format(date, 'gg') // '11' (week of year)
|
|
30
|
+
* format(date, 'gggg') // '2411' (year + week)
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @see {@link longString} for localized long format
|
|
34
|
+
* @see {@link formatNow} for current date formatting
|
|
35
|
+
*/
|
|
36
|
+
declare const format: (value: any, formatStr?: string) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Converts date to localized long string format (Spanish)
|
|
39
|
+
*
|
|
40
|
+
* Formats date as human-readable string with full month name in Spanish locale.
|
|
41
|
+
* Uses dayjs 'LL' format: "15 de marzo de 2024"
|
|
42
|
+
*
|
|
43
|
+
* @param value - Date value to format (null returns empty string)
|
|
44
|
+
* @returns Localized long format date string (e.g., "15 de marzo de 2024")
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* longString(new Date('2024-03-15')) // "15 de marzo de 2024"
|
|
49
|
+
* longString('2024-12-25') // "25 de diciembre de 2024"
|
|
50
|
+
* longString(null) // ""
|
|
51
|
+
*
|
|
52
|
+
* // Real-world: Document headers
|
|
53
|
+
* const reportDate = longString(new Date())
|
|
54
|
+
* console.log(`Informe generado el ${reportDate}`)
|
|
55
|
+
* // "Informe generado el 15 de marzo de 2024"
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @see {@link format} for custom format strings
|
|
59
|
+
*/
|
|
60
|
+
declare const longString: (value?: any) => string;
|
|
61
|
+
/**
|
|
62
|
+
* Converts value to native JavaScript Date object
|
|
63
|
+
*/
|
|
64
|
+
declare const toDate: (value: any, isUtc?: boolean) => Date;
|
|
65
|
+
type DateStringFormat = 'DD/MM/YYYY' | 'YYYY-MM-DD' | 'MM/DD/YYYY' | 'YYYY/MM/DD' | 'DD-MM-YYYY' | 'MM-DD-YYYY' | 'YYYYMMDD' | 'DDMMYYYY' | 'MMDDYYYY' | 'YYYY.MM.DD' | 'DD.MM.YYYY' | 'MM.DD.YYYY';
|
|
66
|
+
/**
|
|
67
|
+
* Parses date string with specific format to native Date object
|
|
68
|
+
*
|
|
69
|
+
* Strict parser that validates format and creates Date from structured date strings.
|
|
70
|
+
* Supports 12 common date formats with validation.
|
|
71
|
+
*
|
|
72
|
+
* @param dateString - Date string to parse
|
|
73
|
+
* @param format - Expected format (DD/MM/YYYY, YYYY-MM-DD, etc.)
|
|
74
|
+
* @returns Date object or null if invalid
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* toDateFromString('15/03/2024', 'DD/MM/YYYY') // Date object
|
|
79
|
+
* toDateFromString('2024-03-15', 'YYYY-MM-DD') // Date object
|
|
80
|
+
* toDateFromString('invalid', 'DD/MM/YYYY') // null
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @see {@link format} for formatting dates
|
|
84
|
+
*/
|
|
85
|
+
declare const toDateFromString: (dateString: string, format: DateStringFormat) => Date | null;
|
|
86
|
+
/**
|
|
87
|
+
* Returns current date
|
|
88
|
+
*/
|
|
89
|
+
declare const now: () => Date;
|
|
90
|
+
/**
|
|
91
|
+
* Checks if date is considered "new" based on days threshold
|
|
92
|
+
*/
|
|
93
|
+
declare const isNew: (value: any, daysnew?: number) => boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Converts date to ISO 8601 string (YYYY-MM-DDTHH:mm:ss.sssZ)
|
|
96
|
+
*
|
|
97
|
+
* Standard ISO format for API communication and storage.
|
|
98
|
+
*
|
|
99
|
+
* @param value - Date to convert (null = now)
|
|
100
|
+
* @param isUtc - Force UTC timezone (default: false, uses local)
|
|
101
|
+
* @returns ISO 8601 formatted string
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* toISO() // "2024-03-15T10:30:00.000+01:00" (now, local time)
|
|
106
|
+
* toISO(new Date('2024-03-15')) // "2024-03-15T00:00:00.000+01:00"
|
|
107
|
+
* toISO(new Date('2024-03-15'), true) // "2024-03-14T23:00:00.000Z" (UTC)
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
declare const toISO: (value?: any, isUtc?: boolean) => string;
|
|
111
|
+
/**
|
|
112
|
+
* Returns relative time from now in Spanish (e.g., "hace 2 horas")
|
|
113
|
+
*
|
|
114
|
+
* @param value - Date to compare with now
|
|
115
|
+
* @returns Relative time string in Spanish
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const twoHoursAgo = new Date(Date.now() - 2 * 60 * 60 * 1000)
|
|
120
|
+
* fromNow(twoHoursAgo) // "hace 2 horas"
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
declare const fromNow: (value: any) => string;
|
|
124
|
+
/**
|
|
125
|
+
* Returns day of week (0-6, Sunday is 0)
|
|
126
|
+
*/
|
|
127
|
+
declare const dayOfWeek: (value?: any) => string;
|
|
128
|
+
/**
|
|
129
|
+
* Returns week of year with zero padding
|
|
130
|
+
*/
|
|
131
|
+
declare const weekOfYear: (value?: any) => string;
|
|
132
|
+
/**
|
|
133
|
+
* Calculates difference in days between two dates
|
|
134
|
+
*/
|
|
135
|
+
declare const diffDays: (start: any, end?: any, precise?: boolean) => number;
|
|
136
|
+
/**
|
|
137
|
+
* Calculates difference in business days (weekdays only, excludes weekends)
|
|
138
|
+
*
|
|
139
|
+
* Counts Mon-Fri between two dates, excluding Saturdays and Sundays.
|
|
140
|
+
* Does NOT account for holidays.
|
|
141
|
+
*
|
|
142
|
+
* @param start - Start date
|
|
143
|
+
* @param end - End date (null = now)
|
|
144
|
+
* @param precise - Include fractional days (default: false)
|
|
145
|
+
* @returns Number of business days (Mon-Fri)
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* // Monday to Friday (same week)
|
|
150
|
+
* diffBusinessDays('2024-03-11', '2024-03-15') // 4 business days
|
|
151
|
+
*
|
|
152
|
+
* // Including weekend (skip Sat/Sun)
|
|
153
|
+
* diffBusinessDays('2024-03-15', '2024-03-18') // 1 (Fri to Mon)
|
|
154
|
+
*
|
|
155
|
+
* // Real-world: SLA calculation
|
|
156
|
+
* const ticketCreated = new Date('2024-03-11')
|
|
157
|
+
* const businessDays = diffBusinessDays(ticketCreated)
|
|
158
|
+
* if (businessDays > 5) {
|
|
159
|
+
* console.log('⚠️ SLA violation: > 5 business days')
|
|
160
|
+
* }
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
declare const diffBusinessDays: (start: any, end?: any, precise?: boolean) => number;
|
|
164
|
+
/**
|
|
165
|
+
* Calculates difference in months between two dates
|
|
166
|
+
*/
|
|
167
|
+
declare const diffMonths: (value: any, valueRefOrNow?: any, precise?: boolean) => number;
|
|
168
|
+
/**
|
|
169
|
+
* Calculates difference in years between two dates
|
|
170
|
+
*/
|
|
171
|
+
declare const diffYears: (value: any, valueRefOrNow?: any, precise?: boolean) => number;
|
|
172
|
+
/**
|
|
173
|
+
* Calculates difference in milliseconds between two dates
|
|
174
|
+
*/
|
|
175
|
+
declare const diffMilliSeconds: (value: any, valueRefOrNow?: any) => number;
|
|
176
|
+
/**
|
|
177
|
+
* Adds days to a date
|
|
178
|
+
*/
|
|
179
|
+
declare const addDays: (value: any, nDays?: number) => Date;
|
|
180
|
+
/**
|
|
181
|
+
* Adds seconds to a date
|
|
182
|
+
*/
|
|
183
|
+
declare const addSeconds: (value: any, nSeconds?: number) => Date;
|
|
184
|
+
/**
|
|
185
|
+
* Compares two dates with ± 2 seconds tolerance
|
|
186
|
+
*/
|
|
187
|
+
declare const areDatesEqualWithTolerance: (date1: Date, date2: Date) => boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Adds days to current date
|
|
190
|
+
*/
|
|
191
|
+
declare const addNowDays: (nDays?: number) => Date;
|
|
192
|
+
/**
|
|
193
|
+
* Adds seconds to current date
|
|
194
|
+
*/
|
|
195
|
+
declare const addNowSeconds: (nSeconds?: number) => Date;
|
|
196
|
+
/**
|
|
197
|
+
* Adds months to a date
|
|
198
|
+
*/
|
|
199
|
+
declare const addMonths: (value: any, nMonths?: number) => Date;
|
|
200
|
+
/**
|
|
201
|
+
* Adds months to current date
|
|
202
|
+
*/
|
|
203
|
+
declare const addNowMonths: (nMonths?: number) => Date;
|
|
204
|
+
/**
|
|
205
|
+
* Adds years to a date
|
|
206
|
+
*/
|
|
207
|
+
declare const addYears: (value: any, nYears?: number) => Date;
|
|
208
|
+
/**
|
|
209
|
+
* Adds years to current date
|
|
210
|
+
*/
|
|
211
|
+
declare const addNowYears: (nYears?: number) => Date;
|
|
212
|
+
/**
|
|
213
|
+
* Converts Excel serial number to Date
|
|
214
|
+
* JavaScript dates can be constructed by passing milliseconds since Unix epoch
|
|
215
|
+
*/
|
|
216
|
+
declare const excelToDate: (value: any) => Date | null;
|
|
217
|
+
/**
|
|
218
|
+
* Detects if a variable contains a valid date
|
|
219
|
+
*/
|
|
220
|
+
declare const isDateTime: (value: any) => boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Compares dates by day
|
|
223
|
+
*/
|
|
224
|
+
declare const isEqualsDateTimeByDay: (value1: any, value2: any) => boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Checks if a date has expired relative to current time
|
|
227
|
+
*/
|
|
228
|
+
declare const isExpired: (value: any, valueRefOrNow?: any) => boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Formats date for MySQL database
|
|
231
|
+
*/
|
|
232
|
+
declare const formatForMysql: (fecha: Date | null) => string | null;
|
|
233
|
+
/**
|
|
234
|
+
* Gets first workday of month
|
|
235
|
+
*/
|
|
236
|
+
declare const getFirstWorkdayOfMonth: (month?: number) => Date;
|
|
237
|
+
/**
|
|
238
|
+
* Gets last workday of month
|
|
239
|
+
*/
|
|
240
|
+
declare const getLastWorkdayOfMonth: (month?: number) => Date;
|
|
241
|
+
/**
|
|
242
|
+
* Gets first workday after adding specified months
|
|
243
|
+
*/
|
|
244
|
+
declare const getFirstWorkdayAfterMonths: (initialDate: Date, n: number) => Date;
|
|
245
|
+
/**
|
|
246
|
+
* Gets first day of current year
|
|
247
|
+
*/
|
|
248
|
+
declare const getFirstDayOfYear: () => Date;
|
|
249
|
+
/**
|
|
250
|
+
* Gets last day of current year
|
|
251
|
+
*/
|
|
252
|
+
declare const getLastDayOfYear: () => Date;
|
|
253
|
+
/**
|
|
254
|
+
* Checks if date is a weekday (not Saturday or Sunday)
|
|
255
|
+
*/
|
|
256
|
+
declare const isWeekday: (date: any) => boolean;
|
|
257
|
+
|
|
258
|
+
declare const dates_addDays: typeof addDays;
|
|
259
|
+
declare const dates_addMonths: typeof addMonths;
|
|
260
|
+
declare const dates_addNowDays: typeof addNowDays;
|
|
261
|
+
declare const dates_addNowMonths: typeof addNowMonths;
|
|
262
|
+
declare const dates_addNowSeconds: typeof addNowSeconds;
|
|
263
|
+
declare const dates_addNowYears: typeof addNowYears;
|
|
264
|
+
declare const dates_addSeconds: typeof addSeconds;
|
|
265
|
+
declare const dates_addYears: typeof addYears;
|
|
266
|
+
declare const dates_areDatesEqualWithTolerance: typeof areDatesEqualWithTolerance;
|
|
267
|
+
declare const dates_dayOfWeek: typeof dayOfWeek;
|
|
268
|
+
declare const dates_diffBusinessDays: typeof diffBusinessDays;
|
|
269
|
+
declare const dates_diffDays: typeof diffDays;
|
|
270
|
+
declare const dates_diffMilliSeconds: typeof diffMilliSeconds;
|
|
271
|
+
declare const dates_diffMonths: typeof diffMonths;
|
|
272
|
+
declare const dates_diffYears: typeof diffYears;
|
|
273
|
+
declare const dates_excelToDate: typeof excelToDate;
|
|
274
|
+
declare const dates_format: typeof format;
|
|
275
|
+
declare const dates_formatForMysql: typeof formatForMysql;
|
|
276
|
+
declare const dates_formatNow: typeof formatNow;
|
|
277
|
+
declare const dates_fromNow: typeof fromNow;
|
|
278
|
+
declare const dates_getFirstDayOfYear: typeof getFirstDayOfYear;
|
|
279
|
+
declare const dates_getFirstWorkdayAfterMonths: typeof getFirstWorkdayAfterMonths;
|
|
280
|
+
declare const dates_getFirstWorkdayOfMonth: typeof getFirstWorkdayOfMonth;
|
|
281
|
+
declare const dates_getLastDayOfYear: typeof getLastDayOfYear;
|
|
282
|
+
declare const dates_getLastWorkdayOfMonth: typeof getLastWorkdayOfMonth;
|
|
283
|
+
declare const dates_isDateTime: typeof isDateTime;
|
|
284
|
+
declare const dates_isEqualsDateTimeByDay: typeof isEqualsDateTimeByDay;
|
|
285
|
+
declare const dates_isExpired: typeof isExpired;
|
|
286
|
+
declare const dates_isNew: typeof isNew;
|
|
287
|
+
declare const dates_isWeekday: typeof isWeekday;
|
|
288
|
+
declare const dates_longString: typeof longString;
|
|
289
|
+
declare const dates_now: typeof now;
|
|
290
|
+
declare const dates_toDate: typeof toDate;
|
|
291
|
+
declare const dates_toDateFromString: typeof toDateFromString;
|
|
292
|
+
declare const dates_toISO: typeof toISO;
|
|
293
|
+
declare const dates_weekOfYear: typeof weekOfYear;
|
|
294
|
+
declare namespace dates {
|
|
295
|
+
export { dates_addDays as addDays, dates_addMonths as addMonths, dates_addNowDays as addNowDays, dates_addNowMonths as addNowMonths, dates_addNowSeconds as addNowSeconds, dates_addNowYears as addNowYears, dates_addSeconds as addSeconds, dates_addYears as addYears, dates_areDatesEqualWithTolerance as areDatesEqualWithTolerance, dates_dayOfWeek as dayOfWeek, dates_diffBusinessDays as diffBusinessDays, dates_diffDays as diffDays, dates_diffMilliSeconds as diffMilliSeconds, dates_diffMonths as diffMonths, dates_diffYears as diffYears, dates_excelToDate as excelToDate, dates_format as format, dates_formatForMysql as formatForMysql, dates_formatNow as formatNow, dates_fromNow as fromNow, dates_getFirstDayOfYear as getFirstDayOfYear, dates_getFirstWorkdayAfterMonths as getFirstWorkdayAfterMonths, dates_getFirstWorkdayOfMonth as getFirstWorkdayOfMonth, dates_getLastDayOfYear as getLastDayOfYear, dates_getLastWorkdayOfMonth as getLastWorkdayOfMonth, dates_isDateTime as isDateTime, dates_isEqualsDateTimeByDay as isEqualsDateTimeByDay, dates_isExpired as isExpired, dates_isNew as isNew, dates_isWeekday as isWeekday, dates_longString as longString, dates_now as now, dates_toDate as toDate, dates_toDateFromString as toDateFromString, dates_toISO as toISO, dates_weekOfYear as weekOfYear };
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export { excelToDate as A, isDateTime as B, isEqualsDateTimeByDay as C, isExpired as D, formatForMysql as E, getFirstWorkdayOfMonth as F, getLastWorkdayOfMonth as G, getFirstWorkdayAfterMonths as H, getFirstDayOfYear as I, getLastDayOfYear as J, isWeekday as K, format as a, toDateFromString as b, toISO as c, dates as d, fromNow as e, formatNow as f, dayOfWeek as g, diffDays as h, isNew as i, diffBusinessDays as j, diffMonths as k, longString as l, diffYears as m, now as n, diffMilliSeconds as o, addDays as p, addSeconds as q, areDatesEqualWithTolerance as r, addNowDays as s, toDate as t, addNowSeconds as u, addMonths as v, weekOfYear as w, addNowMonths as x, addYears as y, addNowYears as z };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { p as addDays, v as addMonths, s as addNowDays, x as addNowMonths, u as addNowSeconds, z as addNowYears, q as addSeconds, y as addYears, r as areDatesEqualWithTolerance, g as dayOfWeek, j as diffBusinessDays, h as diffDays, o as diffMilliSeconds, k as diffMonths, m as diffYears, A as excelToDate, a as format, E as formatForMysql, f as formatNow, e as fromNow, I as getFirstDayOfYear, H as getFirstWorkdayAfterMonths, F as getFirstWorkdayOfMonth, J as getLastDayOfYear, G as getLastWorkdayOfMonth, B as isDateTime, C as isEqualsDateTimeByDay, D as isExpired, i as isNew, K as isWeekday, l as longString, n as now, t as toDate, b as toDateFromString, c as toISO, w as weekOfYear } from './dates-hTiE0Z11.js';
|