@keltoi/hydra 2.5.2 → 2.5.4

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.
Files changed (2) hide show
  1. package/index.js +11 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -212,7 +212,7 @@ class Traceable extends Entity{
212
212
  }){
213
213
  super(key,struct);
214
214
 
215
- this.#createdAt = createdAt;
215
+ this.#createdAt = createdAt instanceof Date ? createdAt : new Date(createdAt);
216
216
  }
217
217
 
218
218
  get createdAt(){ return this.#createdAt }
@@ -328,18 +328,22 @@ class Changeable extends Entity{
328
328
  struct
329
329
  );
330
330
 
331
- this.#createdAt = createdAt;
332
- this.#updatedAt = updatedAt;
331
+ this.#createdAt = createdAt instanceof Date ? createdAt : new Date(createdAt);
332
+ this.#updatedAt = updatedAt instanceof Date
333
+ ? updatedAt
334
+ : !!updatedAt
335
+ ? new Date(updatedAt)
336
+ : undefined;
333
337
  this.#active = active;
334
338
  }
335
339
 
336
- get createdAt(){ return this.createdAt }
337
- get updatedAt(){ return this.updatedAt }
338
- get active(){ return this.active }
340
+ get createdAt(){ return this.#createdAt }
341
+ get updatedAt(){ return this.#updatedAt}
342
+ get active(){ return this.#active }
339
343
 
340
344
  get change(){
341
345
  return {
342
- updatedAt: this.updatedAt
346
+ updatedAt: this.#updatedAt
343
347
  }
344
348
  }
345
349
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keltoi/hydra",
3
- "version": "2.5.2",
3
+ "version": "2.5.4",
4
4
  "description": "Boilerplate to start your API from zero using Repository Pattern",
5
5
  "main": "index.js",
6
6
  "module": "index.js",