@reldens/utils 0.31.0 → 0.33.0

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.
@@ -113,4 +113,4 @@ class SchemaValidator
113
113
 
114
114
  }
115
115
 
116
- module.exports.SchemaValidator = SchemaValidator;
116
+ module.exports = SchemaValidator;
package/lib/shortcuts.js CHANGED
@@ -295,6 +295,22 @@ class Shortcuts
295
295
  return (new Date()).toISOString().slice(0, 19).replace('T', '-').replace(/:/g, '-');
296
296
  }
297
297
 
298
+ formatDate(date, format = 'Y-m-d H:i:s')
299
+ {
300
+ if(!(date instanceof Date)){
301
+ return date;
302
+ }
303
+ let map = {
304
+ Y: date.getFullYear(),
305
+ m: (date.getMonth() + 1).toString().padStart(2, '0'),
306
+ d: date.getDate().toString().padStart(2, '0'),
307
+ H: date.getHours().toString().padStart(2, '0'),
308
+ i: date.getMinutes().toString().padStart(2, '0'),
309
+ s: date.getSeconds().toString().padStart(2, '0')
310
+ };
311
+ return format.replace(/Y|m|d|H|i|s/g, matched => map[matched]);
312
+ }
313
+
298
314
  getTime()
299
315
  {
300
316
  return (new Date()).getTime();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reldens/utils",
3
3
  "scope": "@reldens",
4
- "version": "0.31.0",
4
+ "version": "0.33.0",
5
5
  "description": "Reldens - Utils",
6
6
  "author": "Damian A. Pastorini",
7
7
  "license": "MIT",