@bluedot-innovation/models 2.0.7-alpha.4 → 2.0.7-alpha.5

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.
@@ -17,7 +17,7 @@ CalendarDateRangeFilterSchema.add({
17
17
  {type: String, required: true}
18
18
  })
19
19
 
20
- function validateDateRange (endDate) {
20
+ function validateDateRange (endDate, magicCallback) {
21
21
  let startDate = this.startDate
22
22
 
23
23
  if (this.startDate) {
@@ -29,10 +29,11 @@ function validateDateRange (endDate) {
29
29
  }
30
30
 
31
31
  if (endDate && endDate < (new Date())) {
32
- throw new Error('endDate cannot be less than current date. ')
32
+ return magicCallback(false, `endDate cannot be less than current date.`)
33
33
  } else if (startDate && endDate && endDate < startDate) {
34
- throw new Error('startDate has to be less than endDate. ')
34
+ return magicCallback(false, `startDate has to be less than endDate. `)
35
35
  }
36
+ magicCallback(true)
36
37
  }
37
38
 
38
39
  // optional mongoose
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "2.0.7-alpha.4",
3
+ "version": "2.0.7-alpha.5",
4
4
  "description": "",
5
5
  "main": "Models.js",
6
6
  "scripts": {