@bluedot-innovation/models 3.0.0 → 3.0.1
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.
- package/CHANGELOG.md +3 -0
- package/models/filters/DayRange.js +7 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -15,9 +15,13 @@ DayRangeFilterSchema.add({
|
|
|
15
15
|
type: {type: String, required: true}
|
|
16
16
|
})
|
|
17
17
|
|
|
18
|
-
function validateDateRange (endDate,
|
|
18
|
+
function validateDateRange (endDate, callback) {
|
|
19
19
|
let startDate = this.startDate
|
|
20
20
|
|
|
21
|
+
if (!startDate && !endDate) {
|
|
22
|
+
return callback(false, `Must have a startDate, endDate, or both.`)
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
if (this.startDate) {
|
|
22
26
|
startDate = new Date(this.startDate)
|
|
23
27
|
}
|
|
@@ -27,9 +31,9 @@ function validateDateRange (endDate, magicCallback) {
|
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
if (startDate && endDate && endDate < startDate) {
|
|
30
|
-
return
|
|
34
|
+
return callback(false, `startDate has to be less than endDate.`)
|
|
31
35
|
}
|
|
32
|
-
|
|
36
|
+
callback(true)
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
// optional mongoose
|
package/package.json
CHANGED