@foxify/odin
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -28,3 +28,3 @@ /* | ||
protected _type: string; | ||
protected _base(v: any): "Must be a date" | null; | ||
protected _base(v: any): "Must be a valid date" | null; | ||
min(date: Date | (() => Date)): this; | ||
@@ -31,0 +31,0 @@ max(date: Date | (() => Date)): this; |
@@ -31,17 +31,17 @@ /* | ||
const e = require("../utils"), t = require("./Any"); | ||
const t = require("../utils"), e = require("./Any"); | ||
exports.default = class TypeDate extends t.default { | ||
exports.default = class TypeDate extends e.default { | ||
constructor() { | ||
super(...arguments), this._type = "Date"; | ||
} | ||
_base(t) { | ||
return e.date.isDate(t) ? null : "Must be a date"; | ||
_base(e) { | ||
return (t.string.isString(e) || t.number.isNumber(e)) && (e = new Date(e)), t.date.isDate(e) && "Invalid Date" !== e.toString() ? null : "Must be a valid date"; | ||
} | ||
min(t) { | ||
return e.date.isDate(t) && (t = (() => t)), this._test(e => e < t() ? `Must be at least ${t}` : null); | ||
min(e) { | ||
return t.date.isDate(e) && (e = (() => e)), this._test(t => t < e() ? `Must be at least ${e}` : null); | ||
} | ||
max(t) { | ||
return e.date.isDate(t) && (t = (() => t)), this._test(e => e > t() ? `Must be at most ${t}` : null); | ||
max(e) { | ||
return t.date.isDate(e) && (e = (() => e)), this._test(t => t > e() ? `Must be at most ${e}` : null); | ||
} | ||
}; |
{ | ||
"name": "@foxify/odin", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "Active Record Model", | ||
@@ -5,0 +5,0 @@ "author": "Ardalan Amini <ardalanamini22@gmail.com> [https://github.com/ardalanamini]", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
193610