@nu-art/ts-common 0.202.1 → 0.202.2

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/ts-common",
3
- "version": "0.202.1",
3
+ "version": "0.202.2",
4
4
  "description": "js and ts infra",
5
5
  "keywords": [
6
6
  "TacB0sS",
@@ -135,7 +135,7 @@ const DateTimeFormat = (format) => {
135
135
  };
136
136
  exports.DateTimeFormat = DateTimeFormat;
137
137
  function isSameDay(date1, date2) {
138
- return moment(date1).isSame(date2);
138
+ return moment(date1).isSame(date2, 'day');
139
139
  }
140
140
  exports.isSameDay = isSameDay;
141
141
  function deltaDays(d1, d2) {
@@ -146,8 +146,8 @@ function deltaDays(d1, d2) {
146
146
  return 0;
147
147
  const millis1 = typeof d1 === 'number' ? d1 : d1.getTime();
148
148
  const millis2 = typeof d2 === 'number' ? d2 : d2.getTime();
149
- const days = (millis1 - millis2) / exports.Day;
150
- //If date2 + the amount of days calculated actually lands on the same day as day1, return days
149
+ const days = Math.floor((millis1 - millis2) / exports.Day);
150
+ //If date2 + the amount of days calculated actually lands on the same day as date1, return days
151
151
  //Else, an extra day needs to be given
152
152
  const date2Offset = new Date(date2.getTime() + (days * exports.Day));
153
153
  return isSameDay(date1, date2Offset) ? days : days + 1;