carbon-react 125.9.1 → 125.9.2
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.
|
@@ -37,15 +37,14 @@ const validationMessages = (locale, month, daysInMonth) => ({
|
|
|
37
37
|
yyyy: locale.numeralDate.validation.year()
|
|
38
38
|
});
|
|
39
39
|
const getDaysInMonth = (month, year) => {
|
|
40
|
-
if (month
|
|
40
|
+
if (!month || +month > 12 || +month < 1) {
|
|
41
41
|
return 31;
|
|
42
42
|
}
|
|
43
43
|
const currentDate = new Date();
|
|
44
44
|
const computedYear = +(year || currentDate.getFullYear());
|
|
45
|
-
const computedMonth = +(month || currentDate.getMonth() + 1);
|
|
46
45
|
|
|
47
46
|
// passing 0 as the third argument ensures we handle for months being 0 indexed
|
|
48
|
-
return new Date(computedYear,
|
|
47
|
+
return new Date(computedYear, +month, 0).getDate();
|
|
49
48
|
};
|
|
50
49
|
const validate = (locale, {
|
|
51
50
|
dd,
|
|
@@ -46,15 +46,14 @@ const validationMessages = (locale, month, daysInMonth) => ({
|
|
|
46
46
|
yyyy: locale.numeralDate.validation.year()
|
|
47
47
|
});
|
|
48
48
|
const getDaysInMonth = (month, year) => {
|
|
49
|
-
if (month
|
|
49
|
+
if (!month || +month > 12 || +month < 1) {
|
|
50
50
|
return 31;
|
|
51
51
|
}
|
|
52
52
|
const currentDate = new Date();
|
|
53
53
|
const computedYear = +(year || currentDate.getFullYear());
|
|
54
|
-
const computedMonth = +(month || currentDate.getMonth() + 1);
|
|
55
54
|
|
|
56
55
|
// passing 0 as the third argument ensures we handle for months being 0 indexed
|
|
57
|
-
return new Date(computedYear,
|
|
56
|
+
return new Date(computedYear, +month, 0).getDate();
|
|
58
57
|
};
|
|
59
58
|
const validate = (locale, {
|
|
60
59
|
dd,
|