socket-function 0.12.12 → 0.12.14
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 +2 -2
- package/src/formatting/format.ts +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "socket-function",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.14",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"node-forge": "https://github.com/sliftist/forge#name",
|
|
14
14
|
"pako": "^2.1.0",
|
|
15
15
|
"preact": "^10.10.6",
|
|
16
|
-
"typenode": "^5.
|
|
16
|
+
"typenode": "^5.4.0",
|
|
17
17
|
"ws": "^8.8.0"
|
|
18
18
|
},
|
|
19
19
|
"optionalDependencies": {
|
package/src/formatting/format.ts
CHANGED
|
@@ -221,4 +221,13 @@ export function formatDateTime(time: number) {
|
|
|
221
221
|
hours = hours ? hours : 12; // the hour '0' should be '12'
|
|
222
222
|
let strTime = p(hours) + ":" + p(minutes) + ":" + p(seconds) + " " + ampm;
|
|
223
223
|
return date.getFullYear() + "/" + p(date.getMonth() + 1) + "/" + p(date.getDate()) + " " + strTime;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** YYYY/MM/DD */
|
|
227
|
+
export function formatDate(time: number) {
|
|
228
|
+
function p(s: number) {
|
|
229
|
+
return s.toString().padStart(2, "0");
|
|
230
|
+
}
|
|
231
|
+
let date = new Date(time);
|
|
232
|
+
return date.getFullYear() + "/" + p(date.getMonth() + 1) + "/" + p(date.getDate());
|
|
224
233
|
}
|