Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
fix(Repository): default empty dates to null
Browse files Browse the repository at this point in the history
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 0086a0a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/repository.js
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0086a0a

Please sign in to comment.