@likable-hair/svelte 0.0.32 → 0.0.33
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/dates/utils.d.ts +1 -1
- package/dates/utils.js +15 -6
- package/package.json +1 -1
- package/timeline/SimpleTimeLine.svelte.d.ts +1 -1
package/dates/utils.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ export declare type MonthStats = {
|
|
|
9
9
|
days: number;
|
|
10
10
|
};
|
|
11
11
|
export declare const getDateRows: (monthIndex: number, year: number) => number[];
|
|
12
|
-
declare type dateFormat = 'extended';
|
|
12
|
+
declare type dateFormat = 'extended' | 'extendedMonthAndYear';
|
|
13
13
|
export declare const dateToString: (date: Date, format?: dateFormat) => string;
|
|
14
14
|
export {};
|
package/dates/utils.js
CHANGED
|
@@ -57,13 +57,22 @@ export const getDateRows = (monthIndex, year) => {
|
|
|
57
57
|
}
|
|
58
58
|
return rows.filter(el => !Array.isArray(el));
|
|
59
59
|
};
|
|
60
|
+
const dateToExtendedString = (date) => {
|
|
61
|
+
const day = date.getDate();
|
|
62
|
+
const month = getMonthName(date.getMonth());
|
|
63
|
+
const year = date.getFullYear();
|
|
64
|
+
return `${day} ${month} ${year}`;
|
|
65
|
+
};
|
|
66
|
+
const dateToExtendedMonthAndYearString = (date) => {
|
|
67
|
+
const month = getMonthName(date.getMonth());
|
|
68
|
+
const year = date.getFullYear();
|
|
69
|
+
return `${month} ${year}`;
|
|
70
|
+
};
|
|
60
71
|
export const dateToString = (date, format = 'extended') => {
|
|
61
|
-
let stringDate = "";
|
|
62
72
|
if (format == 'extended') {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
return dateToExtendedString(date);
|
|
74
|
+
}
|
|
75
|
+
else if (format == 'extendedMonthAndYear') {
|
|
76
|
+
return dateToExtendedMonthAndYearString(date);
|
|
67
77
|
}
|
|
68
|
-
return stringDate;
|
|
69
78
|
};
|
package/package.json
CHANGED