socket-function 0.12.12 → 0.12.13

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": "socket-function",
3
- "version": "0.12.12",
3
+ "version": "0.12.13",
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",
@@ -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
  }