Permalink
Browse files

fix(Repository): default empty dates to null

BREAKING CHANGE: this change makes it so that the date value will no longer be a Date instance based on null, but instead will just be null.
  • Loading branch information...
RWOverdijk committed Oct 16, 2018
1 parent 81b712f commit 0086a0a6b921c34831e9e7f7f3befa54858d17fd
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/repository.js
@@ -229,7 +229,13 @@ export class Repository {
let value = data[key];
if (entityMetadata.has('types', key)) {
populatedData[key] = typer.cast(value, entityMetadata.fetch('types', key));
if (dataType === 'date' || dataType === 'datetime') {
if (value) {
populatedData[key] = typer.default.cast(value, dataType);
}
} else {
populatedData[key] = typer.cast(value, entityMetadata.fetch('types', key));
}
continue;
}

0 comments on commit 0086a0a

Please sign in to comment.