date-and-time 2.2.1 → 2.3.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/PLUGINS.md +22 -22
- package/README.md +81 -80
- package/date-and-time.d.ts +304 -0
- package/date-and-time.js +73 -72
- package/esm/date-and-time.es.js +73 -72
- package/esm/date-and-time.mjs +73 -72
- package/esm/plugin/timezone.es.js +1 -1
- package/esm/plugin/timezone.mjs +1 -1
- package/locale/ar.d.ts +1 -0
- package/locale/az.d.ts +1 -0
- package/locale/bn.d.ts +1 -0
- package/locale/cs.d.ts +1 -0
- package/locale/de.d.ts +1 -0
- package/locale/dk.d.ts +1 -0
- package/locale/el.d.ts +1 -0
- package/locale/en.d.ts +1 -0
- package/locale/es.d.ts +1 -0
- package/locale/fa.d.ts +1 -0
- package/locale/fr.d.ts +1 -0
- package/locale/hi.d.ts +1 -0
- package/locale/hu.d.ts +1 -0
- package/locale/id.d.ts +1 -0
- package/locale/it.d.ts +1 -0
- package/locale/ja.d.ts +1 -0
- package/locale/jv.d.ts +1 -0
- package/locale/ko.d.ts +1 -0
- package/locale/my.d.ts +1 -0
- package/locale/nl.d.ts +1 -0
- package/locale/pa-in.d.ts +1 -0
- package/locale/pl.d.ts +1 -0
- package/locale/pt.d.ts +1 -0
- package/locale/ro.d.ts +1 -0
- package/locale/ru.d.ts +1 -0
- package/locale/rw.d.ts +1 -0
- package/locale/sr.d.ts +1 -0
- package/locale/sv.d.ts +1 -0
- package/locale/th.d.ts +1 -0
- package/locale/tr.d.ts +1 -0
- package/locale/uk.d.ts +1 -0
- package/locale/uz.d.ts +1 -0
- package/locale/vi.d.ts +1 -0
- package/locale/zh-cn.d.ts +1 -0
- package/locale/zh-tw.d.ts +1 -0
- package/package.json +6 -3
- package/plugin/day-of-week.d.ts +1 -0
- package/plugin/meridiem.d.ts +1 -0
- package/plugin/microsecond.d.ts +1 -0
- package/plugin/ordinal.d.ts +1 -0
- package/plugin/timespan.d.ts +24 -0
- package/plugin/timezone.d.ts +79 -0
- package/plugin/timezone.js +1 -1
- package/plugin/two-digit-year.d.ts +1 -0
package/locale/pl.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown): string;
|
package/locale/pt.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown): string;
|
package/locale/ro.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown): string;
|
package/locale/ru.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown): string;
|
package/locale/rw.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown): string;
|
package/locale/sr.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown): string;
|
package/locale/sv.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown): string;
|
package/locale/th.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown): string;
|
package/locale/tr.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown): string;
|
package/locale/uk.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown): string;
|
package/locale/uz.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown): string;
|
package/locale/vi.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown): string;
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "date-and-time",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "A Minimalist DateTime utility for Node.js and the browser",
|
|
5
5
|
"main": "date-and-time.js",
|
|
6
6
|
"module": "esm/date-and-time.es.js",
|
|
7
|
+
"types": "date-and-time.d.ts",
|
|
7
8
|
"unpkg": "date-and-time.min.js",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
@@ -24,7 +25,8 @@
|
|
|
24
25
|
},
|
|
25
26
|
"scripts": {
|
|
26
27
|
"build": "rollup --config rollup.config.js",
|
|
27
|
-
"test": "./test.sh"
|
|
28
|
+
"test": "./test.sh",
|
|
29
|
+
"test:ts": "tsd ./test/ts"
|
|
28
30
|
},
|
|
29
31
|
"repository": {
|
|
30
32
|
"type": "git",
|
|
@@ -48,6 +50,7 @@
|
|
|
48
50
|
"expect.js": "^0.3.1",
|
|
49
51
|
"mocha": "^9.2.1",
|
|
50
52
|
"mocha-headless-chrome": "^4.0.0",
|
|
51
|
-
"rollup": "^2.
|
|
53
|
+
"rollup": "^2.70.0",
|
|
54
|
+
"tsd": "^0.19.1"
|
|
52
55
|
}
|
|
53
56
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown, localized_date?: unknown): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown, localized_date?: unknown): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown, localized_date?: unknown): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown, localized_date?: unknown): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare module '../date-and-time' {
|
|
2
|
+
export type TimeSpanResult = {
|
|
3
|
+
/** Returns the result value in milliseconds. */
|
|
4
|
+
toMilliseconds: (formatString: string) => string,
|
|
5
|
+
/** Returns the result value in seconds. */
|
|
6
|
+
toSeconds: (formatString: string) => string,
|
|
7
|
+
/** Returns the result value in minutes. */
|
|
8
|
+
toMinutes: (formatString: string) => string,
|
|
9
|
+
/** Returns the result value in hours. */
|
|
10
|
+
toHours: (formatString: string) => string,
|
|
11
|
+
/** Returns the result value in days. */
|
|
12
|
+
toDays: (formatString: string) => string
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Subtracting two dates (date1 - date2)
|
|
17
|
+
* @param date1 - A Date object
|
|
18
|
+
* @param date2 - A Date object
|
|
19
|
+
* @returns The result object of subtracting date2 from date1
|
|
20
|
+
*/
|
|
21
|
+
export function timeSpan(date1: Date, date2: Date): TimeSpanResult;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default function (date: unknown, localized_date?: unknown): string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
declare module '../date-and-time' {
|
|
2
|
+
/**
|
|
3
|
+
* Formatting date and time objects using time zone names (Date -> String)
|
|
4
|
+
* @param dateObj - A Date object
|
|
5
|
+
* @param formatString - A format string
|
|
6
|
+
* @param [timeZone] - Output as this time zone
|
|
7
|
+
* @returns A formatted string
|
|
8
|
+
*/
|
|
9
|
+
export function formatTZ(dateObj: Date, formatString: string, timeZone?: string): string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Formatting date and time objects using time zone names (Date -> String)
|
|
13
|
+
* @param dateObj - A Date object
|
|
14
|
+
* @param compiledObj - A compiled object of format string
|
|
15
|
+
* @param [timeZone] - Output as this time zone
|
|
16
|
+
* @returns A formatted string
|
|
17
|
+
*/
|
|
18
|
+
export function formatTZ(dateObj: Date, compiledObj: string[], timeZone?: string): string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Parsing date and time strings using time zone names (String -> Date)
|
|
22
|
+
* @param dateString - A date and time string
|
|
23
|
+
* @param formatString - A format string
|
|
24
|
+
* @param [timeZone] - Input as this time zone
|
|
25
|
+
* @returns A Date object
|
|
26
|
+
*/
|
|
27
|
+
export function parseTZ(dateString: string, formatString: string, timeZone?: string): Date;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Parsing date and time strings using time zone names (String -> Date)
|
|
31
|
+
* @param dateString - A date and time string
|
|
32
|
+
* @param compiledObj - A compiled object of format string
|
|
33
|
+
* @param [timeZone] - Input as this time zone
|
|
34
|
+
* @returns A Date object
|
|
35
|
+
*/
|
|
36
|
+
export function parseTZ(dateString: string, compiledObj: string[], timeZone?: string): Date;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Format transformation of date and time strings using time zone names (String -> String)
|
|
40
|
+
* @param dateString - A date and time string
|
|
41
|
+
* @param formatString1 - A format string before transformation
|
|
42
|
+
* @param formatString2 - A format string after transformation
|
|
43
|
+
* @param [timeZone] - Output as this time zone
|
|
44
|
+
* @returns A formatted string
|
|
45
|
+
*/
|
|
46
|
+
export function transformTZ(dateString: string, formatString1: string, formatString2: string, timeZone?: string): string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Format transformation of date and time strings using time zone names (String -> String)
|
|
50
|
+
* @param dateString - A date and time string
|
|
51
|
+
* @param formatString - A format string before transformation
|
|
52
|
+
* @param compiledObj - A compiled object of format string after transformation
|
|
53
|
+
* @param [timeZone] - Output as this time zone
|
|
54
|
+
* @returns A formatted string
|
|
55
|
+
*/
|
|
56
|
+
export function transformTZ(dateString: string, formatString: string, compiledObj: string[], timeZone?: string): string;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Format transformation of date and time strings using time zone names (String -> String)
|
|
60
|
+
* @param dateString - A date and time string
|
|
61
|
+
* @param compiledObj - A compiled object of format string before transformation
|
|
62
|
+
* @param formatString - A format string after transformation
|
|
63
|
+
* @param [timeZone] - Output as this time zone
|
|
64
|
+
* @returns A formatted string
|
|
65
|
+
*/
|
|
66
|
+
export function transformTZ(dateString: string, compiledObj: string[], formatString: string, timeZone?: string): string;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Format transformation of date and time strings using time zone names (String -> String)
|
|
70
|
+
* @param dateString - A date and time string
|
|
71
|
+
* @param compiledObj1 - A compiled object of format string before transformation
|
|
72
|
+
* @param compiledObj2 - A compiled object of format string after transformation
|
|
73
|
+
* @param [timeZone] - Output as this time zone
|
|
74
|
+
* @returns A formatted string
|
|
75
|
+
*/
|
|
76
|
+
export function transformTZ(dateString: string, compiledObj1: string[], compiledObj2: string[], timeZone?: string): string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default function (date: unknown, localized_date?: unknown): string;
|
package/plugin/timezone.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (date: unknown, localized_date?: unknown): string;
|