@bluedot-innovation/models 5.1.29 → 5.1.30
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/conditions/DayRange.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
let mongoose = require('mongoose')
|
|
2
2
|
|
|
3
3
|
let schema = {
|
|
4
|
-
startDate: {type: Date},
|
|
4
|
+
startDate: {type: Date, validate: validateDateRange},
|
|
5
5
|
endDate: {type: Date}
|
|
6
6
|
}
|
|
7
7
|
|
|
@@ -11,7 +11,7 @@ let DayRangeConditionSchema = new mongoose.Schema(schema, {
|
|
|
11
11
|
})
|
|
12
12
|
|
|
13
13
|
DayRangeConditionSchema.add({
|
|
14
|
-
type: {type: String, required: true, validate:
|
|
14
|
+
type: {type: String, required: true, validate: validateDateRange}
|
|
15
15
|
})
|
|
16
16
|
|
|
17
17
|
function validateDateRange (type, callback) {
|
|
@@ -20,7 +20,7 @@ function validateDateRange (type, callback) {
|
|
|
20
20
|
|
|
21
21
|
if (!startDate && !endDate) return callback(false, `Must have a startDate, endDate, or both.`)
|
|
22
22
|
|
|
23
|
-
if (!startDate) startDate = new Date(
|
|
23
|
+
if (!startDate) startDate = new Date(startDate)
|
|
24
24
|
|
|
25
25
|
if (!endDate) endDate = new Date(endDate)
|
|
26
26
|
|
package/package.json
CHANGED