@wmfs/json-to-vuelidate 1.22.1 → 1.24.0

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 CHANGED
@@ -1,3 +1,42 @@
1
+ # [1.24.0](https://github.com/wmfs/json-to-vuelidate/compare/v1.23.0...v1.24.0) (2022-01-25)
2
+
3
+
4
+ ### 🛠 Builds
5
+
6
+ * **deps-dev:** update dependency mocha to v9.1.4 ([656944c](https://github.com/wmfs/json-to-vuelidate/commit/656944c937c202d005de92dce768d377ff945a69))
7
+ * **deps-dev:** update dependency mocha to v9.2.0 ([c2b27c8](https://github.com/wmfs/json-to-vuelidate/commit/c2b27c82651e0cb76427e34d9195edfc0251800a))
8
+ * **deps-dev:** update dependency semantic-release to v19 ([3086076](https://github.com/wmfs/json-to-vuelidate/commit/30860760fd8db420b3a8ddc75b1618b72b089f1b))
9
+ * **deps:** update dependency google-libphonenumber to v3.2.26 ([cfd1c95](https://github.com/wmfs/json-to-vuelidate/commit/cfd1c9581ddd32e847651ce639c925bb18aa7494))
10
+
11
+ # [1.23.0](https://github.com/wmfs/json-to-vuelidate/compare/v1.22.3...v1.23.0) (2021-12-09)
12
+
13
+
14
+ ### 🛠 Builds
15
+
16
+ * **deps-dev:** update dependency semantic-release to v18.0.1 ([4fed5c6](https://github.com/wmfs/json-to-vuelidate/commit/4fed5c6439b66e3de4d339f30954dcc9edb149ac))
17
+ * **deps-dev:** update semantic-release monorepo ([8ca62db](https://github.com/wmfs/json-to-vuelidate/commit/8ca62dbb892ff384edb65ee1936f82e324a851bb))
18
+ * **deps:** update dependency vuelidate to v0.7.7 ([aedd1af](https://github.com/wmfs/json-to-vuelidate/commit/aedd1af0bf754447ec98f35eaf09904cb0576e9d))
19
+
20
+
21
+ ### 🚨 Tests
22
+
23
+ * better labels for comparing min/max dates ([ccc5f43](https://github.com/wmfs/json-to-vuelidate/commit/ccc5f434c4ae9142ade2c7c62db7bf65a8915df9))
24
+ * enhance tests for min/max dates ([72ea867](https://github.com/wmfs/json-to-vuelidate/commit/72ea867adeaf4487927b33ae50fe894c6c030bb7))
25
+
26
+ ## [1.22.3](https://github.com/wmfs/json-to-vuelidate/compare/v1.22.2...v1.22.3) (2021-10-27)
27
+
28
+
29
+ ### 🐛 Bug Fixes
30
+
31
+ * compare dates to be inclusive and precise to the day ([10fb6aa](https://github.com/wmfs/json-to-vuelidate/commit/10fb6aa3e512704d40915f6591a4000368bff49c))
32
+
33
+ ## [1.22.2](https://github.com/wmfs/json-to-vuelidate/compare/v1.22.1...v1.22.2) (2021-10-27)
34
+
35
+
36
+ ### 🐛 Bug Fixes
37
+
38
+ * simpler logic of comparing min/max dates ([f1d1a2e](https://github.com/wmfs/json-to-vuelidate/commit/f1d1a2e632858f631a4f6785ea2ce6398da6c505))
39
+
1
40
  ## [1.22.1](https://github.com/wmfs/json-to-vuelidate/compare/v1.22.0...v1.22.1) (2021-10-18)
2
41
 
3
42
 
package/lib/index.js CHANGED
@@ -116,7 +116,7 @@ function parse (val, key) {
116
116
  return false
117
117
  }
118
118
 
119
- return !mValue.isBefore(mMin)
119
+ return mMin.isBefore(mValue, 'day') || mMin.isSame(mValue, 'day')
120
120
  }
121
121
  break
122
122
  }
@@ -131,7 +131,7 @@ function parse (val, key) {
131
131
  return false
132
132
  }
133
133
 
134
- return !mValue.isAfter(mMax)
134
+ return mValue.isBefore(mMax, 'day') || mValue.isSame(mMax, 'day')
135
135
  }
136
136
  break
137
137
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wmfs/json-to-vuelidate",
3
3
  "description": "Takes in a JSON object and products an object of vuelidate expressions.",
4
- "version": "1.22.1",
4
+ "version": "1.24.0",
5
5
  "author": "West Midlands Fire Service",
6
6
  "keywords": [
7
7
  "tymly",
@@ -9,9 +9,9 @@
9
9
  ],
10
10
  "main": "./lib/index.js",
11
11
  "dependencies": {
12
- "vuelidate": "0.7.6",
12
+ "vuelidate": "0.7.7",
13
13
  "lodash.template": "4.5.0",
14
- "google-libphonenumber": "3.2.21",
14
+ "google-libphonenumber": "3.2.26",
15
15
  "moment": "2.29.1"
16
16
  },
17
17
  "devDependencies": {
@@ -21,12 +21,12 @@
21
21
  "codecov": "3.8.3",
22
22
  "conventional-changelog-metahub": "4.0.1",
23
23
  "cz-conventional-changelog": "3.3.0",
24
- "mocha": "9.1.3",
24
+ "mocha": "9.2.0",
25
25
  "nyc": "15.1.0",
26
- "semantic-release": "18.0.0",
26
+ "semantic-release": "19.0.2",
27
27
  "standard": "16.0.4",
28
- "@semantic-release/changelog": "6.0.0",
29
- "@semantic-release/git": "10.0.0"
28
+ "@semantic-release/changelog": "6.0.1",
29
+ "@semantic-release/git": "10.0.1"
30
30
  },
31
31
  "scripts": {
32
32
  "lint": "standard",
package/test/test.js CHANGED
@@ -76,37 +76,29 @@ describe('Test the vuelidate converter', function () {
76
76
  expect(vuelidate.min3DaysAgo.minimumDate).to.be.a('function')
77
77
  })
78
78
 
79
- it('test the validation function for minimum date', () => {
80
- const fn = vuelidate.min3DaysAgo.minimumDate
81
-
82
- const oneWeekAgo = moment().subtract(7, 'day')
83
- const today = moment()
84
- const tomorrow = moment().add(1, 'day')
85
-
86
- const oneWeekAgoResult = fn(oneWeekAgo)
87
- expect(oneWeekAgoResult).to.eql(false)
88
-
89
- const todayResult = fn(today)
90
- expect(todayResult).to.eql(true)
91
-
92
- const tomorrowResult = fn(tomorrow)
93
- expect(tomorrowResult).to.eql(true)
79
+ const dates = [
80
+ ['1 year ago', moment().subtract(1, 'year'), false, true],
81
+ ['7 days ago', moment().subtract(7, 'day'), false, true],
82
+ ['4 days ago', moment().subtract(4, 'day'), false, true],
83
+ ['3 days ago', moment().subtract(3, 'day'), true, true],
84
+ ['yesterday', moment().subtract(1, 'day'), true, true],
85
+ ['today', moment(), true, true],
86
+ ['tomorrow', moment().add(1, 'day'), true, false],
87
+ ['3 days ahead', moment().add(3, 'day'), true, false],
88
+ ['4 days ahead', moment().add(4, 'day'), true, false],
89
+ ['7 days ahead', moment().add(7, 'day'), true, false],
90
+ ['1 year ahead', moment().add(1, 'year'), true, false]
91
+ ]
92
+
93
+ describe('Test the validation function for minimum date', () => {
94
+ for (const [label, date, minResult] of dates) {
95
+ it(`${label}, should${minResult ? '' : ' not'} be after 3 days ago`, () => expect(vuelidate.min3DaysAgo.minimumDate(date)).to.eql(minResult))
96
+ }
94
97
  })
95
98
 
96
- it('test the validation function for maximum date', () => {
97
- const fn = vuelidate.dateOfBirth.maximumDate
98
-
99
- const yesterday = moment().subtract(1, 'day')
100
- const today = moment()
101
- const tomorrow = moment().add(1, 'day')
102
-
103
- const yesterdayResult = fn(yesterday)
104
- expect(yesterdayResult).to.eql(true)
105
-
106
- const todayResult = fn(today)
107
- expect(todayResult).to.eql(false)
108
-
109
- const tomorrowResult = fn(tomorrow)
110
- expect(tomorrowResult).to.eql(false)
99
+ describe('Test the validation function for maximum date', () => {
100
+ for (const [label, date, , maxResult] of dates) {
101
+ it(`${label}, should${maxResult ? '' : ' not'} be before today`, () => expect(vuelidate.dateOfBirth.maximumDate(date)).to.eql(maxResult))
102
+ }
111
103
  })
112
104
  })