@stbmoz-onboarding/core 1.1.5 → 1.1.7

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.
Files changed (2) hide show
  1. package/Dates/dates.js +18 -5
  2. package/package.json +11 -11
package/Dates/dates.js CHANGED
@@ -20,15 +20,32 @@ module.exports.DateFormater = (date, format) => {
20
20
  }
21
21
  }
22
22
 
23
+ const dateGenerator = (date) => {
24
+ date = date.slice(0, 10)
25
+ const _date = date.split('-')
26
+ const newDate = new Date()
27
+ const month = parseInt(_date[1]) -1;
28
+
29
+ newDate.setFullYear(_date[0])
30
+ newDate.setMonth(month)
31
+ newDate.setDate(_date[2])
32
+
33
+ return newDate
34
+
35
+ }
36
+
23
37
  module.exports.ValidateDate = (values, key, errors, invalidDateMsg) => {
38
+ console.log(values[key])
24
39
  try {
25
- const date = new Date(values[key])
40
+ const date = dateGenerator(values[key])
41
+
26
42
  if (date == "Invalid Date") {
27
43
  errors[key] = invalidDateMsg
28
44
  } else {
29
45
  values[key] = date
30
46
  }
31
47
  } catch (error) {
48
+ console.log(error)
32
49
  errors[key] = invalidDateMsg
33
50
  }
34
51
  }
@@ -42,8 +59,6 @@ module.exports.isValidRange = (date, rangeLimit) => {
42
59
  if (m < 0 || (m === 0 && today.getDate() < dateObj.getDate())) {
43
60
  range--
44
61
  }
45
-
46
- console.log(range, rangeLimit)
47
62
  if (range <= rangeLimit) return true
48
63
  }
49
64
 
@@ -57,7 +72,6 @@ module.exports.isValidRangeFuture = (date, rangeLimit) => {
57
72
  range--
58
73
  }
59
74
 
60
- console.log(range, rangeLimit)
61
75
  if (range <= rangeLimit) return true
62
76
  }
63
77
 
@@ -73,7 +87,6 @@ module.exports.isInPast = (date) => {
73
87
 
74
88
  let today = new Date()
75
89
  let dateObj = new Date(date)
76
- // console.log(dateObj, today)
77
90
  if (dateObj >= today) {
78
91
  return true
79
92
  }
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
1
  {
2
2
  "_args": [
3
3
  [
4
- "@stbmoz-onboarding/core@1.1.5",
4
+ "@stbmoz-onboarding/core@1.1.7",
5
5
  "/Users/pedrodava/Desktop/Bank/RAO/frontend"
6
6
  ]
7
7
  ],
8
- "_from": "@stbmoz-onboarding/core@^1.1.5",
9
- "_id": "@stbmoz-onboarding/core@1.1.5",
8
+ "_from": "@stbmoz-onboarding/core@^1.1.7",
9
+ "_id": "@stbmoz-onboarding/core@1.1.7",
10
10
  "_inBundle": false,
11
- "_integrity": "sha512-49Uu6x1QbTWFMWRZQz1A28IjRmo8hA22izluXc5Y2yiDii51nvRvLj/Hu3AjGOYvHlWa+j8J1nVh0fmt93WCnA==",
11
+ "_integrity": "sha512-VGfu7Xxlt1ujpLeAdX+FKQBHPPKkce0i3uNpdX88EXTq0OClQAsAJwZvp5ZfcT4xKSeQfuntYIuH4koL5r2zzw==",
12
12
  "_location": "/@stbmoz-onboarding/core",
13
13
  "_phantomChildren": {},
14
14
  "_requested": {
15
15
  "type": "range",
16
16
  "registry": true,
17
- "raw": "@stbmoz-onboarding/core@^1.1.5",
17
+ "raw": "@stbmoz-onboarding/core@^1.1.7",
18
18
  "name": "@stbmoz-onboarding/core",
19
19
  "escapedName": "@stbmoz-onboarding%2fcore",
20
20
  "scope": "@stbmoz-onboarding",
21
- "rawSpec": "^1.1.5",
21
+ "rawSpec": "^1.1.7",
22
22
  "saveSpec": null,
23
- "fetchSpec": "^1.1.5"
23
+ "fetchSpec": "^1.1.7"
24
24
  },
25
25
  "_requiredBy": [
26
26
  "#USER",
27
27
  "/"
28
28
  ],
29
- "_resolved": "https://registry.npmjs.org/@stbmoz-onboarding/core/-/core-1.1.5.tgz",
30
- "_shasum": "87974a4970b4ae2a12a290bb2ab0d415aab344d1",
31
- "_spec": "@stbmoz-onboarding/core@^1.1.5",
29
+ "_resolved": "https://registry.npmjs.org/@stbmoz-onboarding/core/-/core-1.1.7.tgz",
30
+ "_shasum": "2b487af36c7850491566bfa0c66b8cee101c583a",
31
+ "_spec": "@stbmoz-onboarding/core@^1.1.7",
32
32
  "_where": "/Users/pedrodava/Desktop/Bank/RAO/frontend",
33
33
  "author": "",
34
34
  "bundleDependencies": false,
@@ -42,5 +42,5 @@
42
42
  "test": "echo \"Error: no test specified\" && exit 1"
43
43
  },
44
44
  "type": "commonjs",
45
- "version": "1.1.5"
45
+ "version": "1.1.7"
46
46
  }