puvox-library 1.0.32 → 1.0.34

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.
@@ -1006,6 +1006,20 @@ const puvox_library =
1006
1006
  var result = new Date(date);
1007
1007
  result.setDate(result.getDate() + days);
1008
1008
  return result;
1009
+ },
1010
+ daysBetween(a, b, utc = true){
1011
+ // https://stackoverflow.com/a/15289883/2377343
1012
+ const _MS_PER_DAY = 1000 * 60 * 60 * 24;
1013
+ let d1, d2;
1014
+ // Discard the time and time-zone information.
1015
+ if (utc) {
1016
+ d1 = Date.UTC(a.getUTCFullYear(), a.getUTCMonth(), a.getUTCDate());
1017
+ d2 = Date.UTC(b.getUTCFullYear(), b.getUTCMonth(), b.getUTCDate());
1018
+ } else {
1019
+ d1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
1020
+ d2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate());
1021
+ }
1022
+ return Math.floor((d2 - d1) / _MS_PER_DAY);
1009
1023
  }
1010
1024
  },
1011
1025
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "puvox-library",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "library-class-javascript",
5
5
  "main": "library_standard.js",
6
6
  "scripts": {