catchup-library-web 1.18.4 → 1.18.5
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/package.json
CHANGED
|
@@ -55,7 +55,7 @@ export const retrieveDateIntervalOptionList = () => {
|
|
|
55
55
|
];
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
export const calculateStartDateOfWeek = (date: Date) => {
|
|
58
|
+
export const calculateStartDateOfWeek = (date: Date, isGMT: boolean) => {
|
|
59
59
|
var diff = date.getDate() - date.getDay() + (date.getDay() === 0 ? -6 : 1);
|
|
60
60
|
|
|
61
61
|
const startDate = new Date(date.setDate(diff));
|
|
@@ -63,18 +63,26 @@ export const calculateStartDateOfWeek = (date: Date) => {
|
|
|
63
63
|
startDate.setMinutes(0);
|
|
64
64
|
startDate.setSeconds(0);
|
|
65
65
|
startDate.setMilliseconds(0);
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
if (isGMT) {
|
|
67
|
+
return adjustForTimezone(startDate);
|
|
68
|
+
} else {
|
|
69
|
+
return startDate;
|
|
70
|
+
}
|
|
68
71
|
};
|
|
69
72
|
|
|
70
|
-
export const calculateEndDateOfWeek = (date: Date) => {
|
|
73
|
+
export const calculateEndDateOfWeek = (date: Date, isGMT: boolean) => {
|
|
71
74
|
var lastday = date.getDate() - (date.getDay() - 1) + 6;
|
|
72
75
|
const endDate = new Date(date.setDate(lastday));
|
|
73
76
|
endDate.setHours(23);
|
|
74
77
|
endDate.setMinutes(59);
|
|
75
78
|
endDate.setSeconds(59);
|
|
76
79
|
endDate.setMilliseconds(999);
|
|
77
|
-
|
|
80
|
+
|
|
81
|
+
if (isGMT) {
|
|
82
|
+
return adjustForTimezone(endDate);
|
|
83
|
+
} else {
|
|
84
|
+
return endDate;
|
|
85
|
+
}
|
|
78
86
|
};
|
|
79
87
|
|
|
80
88
|
export const adjustForTimezone = (date: Date) => {
|