catchup-library-web 1.20.20 → 1.20.21

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/index.js CHANGED
@@ -9215,12 +9215,11 @@ var calculateStartDateOfWeek = (date, isGMT) => {
9215
9215
  }
9216
9216
  };
9217
9217
  var calculateEndDateOfWeek = (date, isGMT) => {
9218
- var lastday = date.getDate() - (date.getDay() - 1) + 6;
9219
- const endDate = new Date(date.setDate(lastday));
9220
- endDate.setHours(23);
9221
- endDate.setMinutes(59);
9222
- endDate.setSeconds(59);
9223
- endDate.setMilliseconds(999);
9218
+ const dayOfWeek = date.getDay();
9219
+ const daysUntilSunday = (7 - dayOfWeek) % 7;
9220
+ const endDate = new Date(date);
9221
+ endDate.setDate(date.getDate() + daysUntilSunday);
9222
+ endDate.setHours(23, 59, 59, 999);
9224
9223
  if (isGMT) {
9225
9224
  return adjustForTimezone(endDate);
9226
9225
  } else {
package/dist/index.mjs CHANGED
@@ -8999,12 +8999,11 @@ var calculateStartDateOfWeek = (date, isGMT) => {
8999
8999
  }
9000
9000
  };
9001
9001
  var calculateEndDateOfWeek = (date, isGMT) => {
9002
- var lastday = date.getDate() - (date.getDay() - 1) + 6;
9003
- const endDate = new Date(date.setDate(lastday));
9004
- endDate.setHours(23);
9005
- endDate.setMinutes(59);
9006
- endDate.setSeconds(59);
9007
- endDate.setMilliseconds(999);
9002
+ const dayOfWeek = date.getDay();
9003
+ const daysUntilSunday = (7 - dayOfWeek) % 7;
9004
+ const endDate = new Date(date);
9005
+ endDate.setDate(date.getDate() + daysUntilSunday);
9006
+ endDate.setHours(23, 59, 59, 999);
9008
9007
  if (isGMT) {
9009
9008
  return adjustForTimezone(endDate);
9010
9009
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "1.20.20",
3
+ "version": "1.20.21",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -71,12 +71,12 @@ export const calculateStartDateOfWeek = (date: Date, isGMT: boolean) => {
71
71
  };
72
72
 
73
73
  export const calculateEndDateOfWeek = (date: Date, isGMT: boolean) => {
74
- var lastday = date.getDate() - (date.getDay() - 1) + 6;
75
- const endDate = new Date(date.setDate(lastday));
76
- endDate.setHours(23);
77
- endDate.setMinutes(59);
78
- endDate.setSeconds(59);
79
- endDate.setMilliseconds(999);
74
+ const dayOfWeek = date.getDay();
75
+ const daysUntilSunday = (7 - dayOfWeek) % 7;
76
+
77
+ const endDate = new Date(date);
78
+ endDate.setDate(date.getDate() + daysUntilSunday);
79
+ endDate.setHours(23, 59, 59, 999);
80
80
 
81
81
  if (isGMT) {
82
82
  return adjustForTimezone(endDate);