@cj-tech-master/excelts 2.0.0-canary.20251228013952.4f2c3c6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/excelts.esm.js +8 -8
- package/dist/browser/excelts.esm.js.map +1 -1
- package/dist/browser/excelts.esm.min.js +3 -3
- package/dist/browser/excelts.iife.js +8 -8
- package/dist/browser/excelts.iife.js.map +1 -1
- package/dist/browser/excelts.iife.min.js +3 -3
- package/dist/cjs/utils/datetime.js +156 -7
- package/dist/esm/utils/datetime.js +153 -7
- package/dist/types/utils/datetime.d.ts +29 -0
- package/package.json +1 -1
|
@@ -6,6 +6,35 @@
|
|
|
6
6
|
*/
|
|
7
7
|
/** Supported date format strings */
|
|
8
8
|
export type DateFormat = "YYYY-MM-DD[T]HH:mm:ssZ" | "YYYY-MM-DD[T]HH:mm:ss" | "YYYY-MM-DD[T]HH:mm:ss.SSSZ" | "YYYY-MM-DD" | "YYYY-MM-DD HH:mm:ss" | "MM-DD-YYYY" | "MM-DD-YYYY HH:mm:ss" | "MM/DD/YYYY HH:mm:ss" | "DD-MM-YYYY" | "DD-MM-YYYY HH:mm:ss" | "DD/MM/YYYY HH:mm:ss";
|
|
9
|
+
/**
|
|
10
|
+
* Quick pre-filter to reject non-date strings
|
|
11
|
+
*/
|
|
12
|
+
export declare function mightBeDate(s: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Parse a date string
|
|
15
|
+
*
|
|
16
|
+
* @param value - String to parse
|
|
17
|
+
* @param formats - Specific formats to try (optional, auto-detects ISO if omitted)
|
|
18
|
+
* @returns Date object or null
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* parseDate("2024-12-26") // auto-detect ISO
|
|
22
|
+
* parseDate("12-26-2024", ["MM-DD-YYYY"]) // explicit US format
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseDate(value: string, formats?: DateFormat[]): Date | null;
|
|
25
|
+
/**
|
|
26
|
+
* Format a Date to string
|
|
27
|
+
*
|
|
28
|
+
* @param date - Date to format
|
|
29
|
+
* @param format - Format template (optional, defaults to ISO)
|
|
30
|
+
* @param utc - Use UTC time (default: false)
|
|
31
|
+
* @returns Formatted string or empty string if invalid
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* formatDate(date) // "2024-12-26T10:30:00.000+08:00"
|
|
35
|
+
* formatDate(date, "YYYY-MM-DD", true) // "2024-12-26"
|
|
36
|
+
*/
|
|
37
|
+
export declare function formatDate(date: Date, format?: string, utc?: boolean): string;
|
|
9
38
|
/**
|
|
10
39
|
* Optimized date parser for batch processing
|
|
11
40
|
*
|
package/package.json
CHANGED