puvox-library 1.0.31 → 1.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/library_standard.js +27 -11
- package/package.json +1 -1
package/library_standard.js
CHANGED
@@ -934,8 +934,12 @@ const puvox_library =
|
|
934
934
|
msGoneAfter(date){
|
935
935
|
return (new Date()-date);
|
936
936
|
},
|
937
|
-
getYMDHISFfromDate(dt){
|
938
|
-
|
937
|
+
getYMDHISFfromDate(dt, utc=true){
|
938
|
+
if (utc) {
|
939
|
+
return [dt.getUTCFullYear(), dt.getUTCMonth()+1, dt.getUTCDate(), dt.getUTCHours(), dt.getUTCMinutes(), dt.getUTCSeconds(), dt.getUTCMilliseconds()];
|
940
|
+
} else {
|
941
|
+
return [1900 + dt.getYear(), dt.getMonth()+1, dt.getDate(), dt.getHours(), dt.getMinutes(), dt.getSeconds(), dt.getMilliseconds()];
|
942
|
+
}
|
939
943
|
},
|
940
944
|
prefixWithZero(num, digits){
|
941
945
|
return (digits===1 ? num : (digits===2 ? (num < 10 ? "0"+num : num ) : (digits===3 ? (num < 10 ? "00"+num : (num < 100 ? "0"+num : num ) ) : num ) ) ).toString();
|
@@ -1002,6 +1006,19 @@ const puvox_library =
|
|
1002
1006
|
var result = new Date(date);
|
1003
1007
|
result.setDate(result.getDate() + days);
|
1004
1008
|
return result;
|
1009
|
+
},
|
1010
|
+
daysBetween(a, b, utc = true){
|
1011
|
+
const _MS_PER_DAY = 1000 * 60 * 60 * 24;
|
1012
|
+
let d1, d2;
|
1013
|
+
// Discard the time and time-zone information.
|
1014
|
+
if (utc) {
|
1015
|
+
d1 = Date.UTC(a.getUTCgetFullYear(), a.getUTCMonth(), a.getUTCDate());
|
1016
|
+
d2 = Date.UTC(b.getUTCFullYear(), b.getUTCMonth(), b.getUTCDate());
|
1017
|
+
} else {
|
1018
|
+
d1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
|
1019
|
+
d2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate());
|
1020
|
+
}
|
1021
|
+
return Math.floor((d2 - d1) / _MS_PER_DAY);
|
1005
1022
|
}
|
1006
1023
|
},
|
1007
1024
|
|
@@ -2754,15 +2771,14 @@ const puvox_library =
|
|
2754
2771
|
// if(setHashInAddress) { window.location.hash = id_or_Name; }
|
2755
2772
|
|
2756
2773
|
|
2757
|
-
async downloadFile(url, path){
|
2758
|
-
|
2759
|
-
|
2760
|
-
|
2761
|
-
|
2762
|
-
|
2763
|
-
|
2764
|
-
|
2765
|
-
},
|
2774
|
+
// async downloadFile(url, path){
|
2775
|
+
// const { Readable } = require('stream');
|
2776
|
+
// const { finished } = require('stream/promises');
|
2777
|
+
// const response = await fetch(url);
|
2778
|
+
// const body = Readable.fromWeb(response.body);
|
2779
|
+
// const download_write_stream = this.file.fs().createWriteStream(filepath);
|
2780
|
+
// await finished(body.pipe(download_write_stream));
|
2781
|
+
// },
|
2766
2782
|
|
2767
2783
|
unTrailingSlash(str){
|
2768
2784
|
while (str.endsWith('/') || str.endsWith('\\')) {
|