@stbmoz-onboarding/core 1.1.5 → 1.1.6

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 +16 -5
  2. package/package.json +11 -11
package/Dates/dates.js CHANGED
@@ -20,9 +20,24 @@ 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) => {
24
38
  try {
25
- const date = new Date(values[key])
39
+ const date = dateGenerator(values[key])
40
+
26
41
  if (date == "Invalid Date") {
27
42
  errors[key] = invalidDateMsg
28
43
  } else {
@@ -42,8 +57,6 @@ module.exports.isValidRange = (date, rangeLimit) => {
42
57
  if (m < 0 || (m === 0 && today.getDate() < dateObj.getDate())) {
43
58
  range--
44
59
  }
45
-
46
- console.log(range, rangeLimit)
47
60
  if (range <= rangeLimit) return true
48
61
  }
49
62
 
@@ -57,7 +70,6 @@ module.exports.isValidRangeFuture = (date, rangeLimit) => {
57
70
  range--
58
71
  }
59
72
 
60
- console.log(range, rangeLimit)
61
73
  if (range <= rangeLimit) return true
62
74
  }
63
75
 
@@ -73,7 +85,6 @@ module.exports.isInPast = (date) => {
73
85
 
74
86
  let today = new Date()
75
87
  let dateObj = new Date(date)
76
- // console.log(dateObj, today)
77
88
  if (dateObj >= today) {
78
89
  return true
79
90
  }
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.6",
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.6",
9
+ "_id": "@stbmoz-onboarding/core@1.1.6",
10
10
  "_inBundle": false,
11
- "_integrity": "sha512-49Uu6x1QbTWFMWRZQz1A28IjRmo8hA22izluXc5Y2yiDii51nvRvLj/Hu3AjGOYvHlWa+j8J1nVh0fmt93WCnA==",
11
+ "_integrity": "sha512-jzmeLgErpseqkKJsWBERFiB/wMS6BeSgH9OK1r2uzOWWgKO3iOCUCywu06I5dGSy5xZfRKejG+MNV3KqW4fwQw==",
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.6",
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.6",
22
22
  "saveSpec": null,
23
- "fetchSpec": "^1.1.5"
23
+ "fetchSpec": "^1.1.6"
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.6.tgz",
30
+ "_shasum": "0222e0ea09cafcfddf3bfa6886d142f1e54256c1",
31
+ "_spec": "@stbmoz-onboarding/core@^1.1.6",
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.6"
46
46
  }