astro-accelerator-utils 0.3.68 → 0.3.70
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/lib/v1/dates.d.mts +14 -0
- package/lib/v1/dates.mjs +33 -0
- package/package.json +2 -2
package/lib/v1/dates.d.mts
CHANGED
|
@@ -24,5 +24,19 @@ export class DateFormatter {
|
|
|
24
24
|
* @returns {string}
|
|
25
25
|
*/
|
|
26
26
|
formatShortDate(date: string | Date, lang: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the formatted date without the day
|
|
29
|
+
* @param {string | Date} date
|
|
30
|
+
* @param {string} lang
|
|
31
|
+
* @returns {string}
|
|
32
|
+
*/
|
|
33
|
+
formatDateWithoutDay(date: string | Date, lang: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the formatted short date without the day
|
|
36
|
+
* @param {string | Date} date
|
|
37
|
+
* @param {string} lang
|
|
38
|
+
* @returns {string}
|
|
39
|
+
*/
|
|
40
|
+
formatShortDateWithoutDay(date: string | Date, lang: string): string;
|
|
27
41
|
}
|
|
28
42
|
export type Site = any;
|
package/lib/v1/dates.mjs
CHANGED
|
@@ -40,4 +40,37 @@ export class DateFormatter {
|
|
|
40
40
|
|
|
41
41
|
return '';
|
|
42
42
|
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Returns the formatted date without the day
|
|
46
|
+
* @param {string | Date} date
|
|
47
|
+
* @param {string} lang
|
|
48
|
+
* @returns {string}
|
|
49
|
+
*/
|
|
50
|
+
formatDateWithoutDay(date, lang) {
|
|
51
|
+
if (date) {
|
|
52
|
+
const options = { ...this.dateOptions };
|
|
53
|
+
delete options.weekday;
|
|
54
|
+
delete options.day;
|
|
55
|
+
return new Date(date).toLocaleDateString(lang, options);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return '';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Returns the formatted short date without the day
|
|
63
|
+
* @param {string | Date} date
|
|
64
|
+
* @param {string} lang
|
|
65
|
+
* @returns {string}
|
|
66
|
+
*/
|
|
67
|
+
formatShortDateWithoutDay(date, lang) {
|
|
68
|
+
if (date) {
|
|
69
|
+
const options = { ...this.shortDateOptions };
|
|
70
|
+
delete options.day;
|
|
71
|
+
return new Date(date).toLocaleDateString(lang, options);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return '';
|
|
75
|
+
}
|
|
43
76
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-accelerator-utils",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.70",
|
|
4
4
|
"description": "Astro utilities for Astro Accelerator.",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://astro.stevefenton.co.uk/",
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@types/node": "^25.
|
|
37
|
+
"@types/node": "^25.2.3",
|
|
38
38
|
"jest": "^30.2.0",
|
|
39
39
|
"jest-spec": "^0.0.6",
|
|
40
40
|
"rehype-stringify": "^10.0.1",
|