Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ardalanamini committed Dec 1, 2018
1 parent 7981c33 commit 4abc90f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@foxify/odin",
"version": "0.5.1",
"version": "0.5.2",
"description": "Active Record Model",
"author": "Ardalan Amini <ardalanamini22@gmail.com> [https://github.com/ardalanamini]",
"contributors": [
Expand Down
6 changes: 4 additions & 2 deletions src/types/Date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ class TypeDate extends TypeAny {
protected _type = "Date";

protected _base(v: any) {
if (utils.date.isDate(v)) return null;
if (utils.string.isString(v) || utils.number.isNumber(v)) v = new Date(v);

return "Must be a date";
if (utils.date.isDate(v) && v.toString() !== "Invalid Date") return null;

return "Must be a valid date";
}

public min(date: Date | (() => Date)) {
Expand Down

0 comments on commit 4abc90f

Please sign in to comment.