@eeacms/volto-clms-theme 1.1.62 → 1.1.64
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
|
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
### [1.1.64](https://github.com/eea/volto-clms-theme/compare/1.1.63...1.1.64) - 19 October 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- styling of videos [Mikel Larreategi - [`1724985`](https://github.com/eea/volto-clms-theme/commit/172498528b8d9e6ed6f2b8a3cddca7a0d43034fa)]
|
|
12
|
+
### [1.1.63](https://github.com/eea/volto-clms-theme/compare/1.1.62...1.1.63) - 19 October 2023
|
|
13
|
+
|
|
14
|
+
#### :hammer_and_wrench: Others
|
|
15
|
+
|
|
16
|
+
- more date restrictions and specifications [masanchez85 - [`d476ab2`](https://github.com/eea/volto-clms-theme/commit/d476ab2b13e0e6f6909dd91c7c2c71c782ff9fc8)]
|
|
7
17
|
### [1.1.62](https://github.com/eea/volto-clms-theme/compare/1.1.61...1.1.62) - 18 October 2023
|
|
8
18
|
|
|
9
19
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -26,19 +26,74 @@ export const TimeseriesPicker = (props) => {
|
|
|
26
26
|
? 'week'
|
|
27
27
|
: 'year';
|
|
28
28
|
|
|
29
|
+
const monthDiff = (d1, d2) => {
|
|
30
|
+
var months;
|
|
31
|
+
months = (d2.getFullYear() - d1.getFullYear()) * 12;
|
|
32
|
+
months -= d1.getMonth();
|
|
33
|
+
months += d2.getMonth();
|
|
34
|
+
return months <= 0 ? 0 : months;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const isLeptYear = (year) => {
|
|
38
|
+
return year % 400 === 0 ? true : year % 100 === 0 ? false : year % 4 === 0;
|
|
39
|
+
};
|
|
40
|
+
|
|
29
41
|
const validDaysDifference = (value) => {
|
|
30
42
|
const periocity = item.name.includes('10-daily')
|
|
31
|
-
?
|
|
43
|
+
? 1
|
|
32
44
|
: item.name.includes('daily')
|
|
33
45
|
? 7
|
|
34
|
-
:
|
|
46
|
+
: 1;
|
|
35
47
|
let validValue = false;
|
|
36
48
|
const diffTime = Math.abs(
|
|
37
49
|
new Date(value['EndDate']) - new Date(value['StartDate']),
|
|
38
50
|
);
|
|
39
51
|
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
|
40
|
-
|
|
52
|
+
const diffMonths = monthDiff(
|
|
53
|
+
new Date(value['StartDate']),
|
|
54
|
+
new Date(value['EndDate']),
|
|
55
|
+
);
|
|
56
|
+
const diffYears =
|
|
57
|
+
new Date(value['EndDate']).getFullYear() -
|
|
58
|
+
new Date(value['StartDate']).getFullYear();
|
|
59
|
+
if (daysrestriction === 'week' && diffDays < periocity) {
|
|
41
60
|
validValue = true;
|
|
61
|
+
} else if (daysrestriction === 'month' && diffMonths <= periocity) {
|
|
62
|
+
const startDate = new Date(value['StartDate']);
|
|
63
|
+
const startDateMonth = startDate.getMonth();
|
|
64
|
+
if (
|
|
65
|
+
(startDateMonth === 3 ||
|
|
66
|
+
startDateMonth === 5 ||
|
|
67
|
+
startDateMonth === 8 ||
|
|
68
|
+
startDateMonth === 10) &&
|
|
69
|
+
diffDays <= 30
|
|
70
|
+
)
|
|
71
|
+
validValue = true;
|
|
72
|
+
else if (
|
|
73
|
+
startDateMonth === 1 &&
|
|
74
|
+
isLeptYear(startDate.getFullYear()) &&
|
|
75
|
+
diffDays <= 29
|
|
76
|
+
)
|
|
77
|
+
validValue = true;
|
|
78
|
+
else if (startDateMonth === 1 && diffDays <= 28) validValue = true;
|
|
79
|
+
else if (
|
|
80
|
+
startDateMonth !== 1 &&
|
|
81
|
+
startDateMonth !== 3 &&
|
|
82
|
+
startDateMonth !== 5 &&
|
|
83
|
+
startDateMonth !== 8 &&
|
|
84
|
+
startDateMonth !== 10 &&
|
|
85
|
+
diffDays <= 31
|
|
86
|
+
)
|
|
87
|
+
validValue = true;
|
|
88
|
+
} else if (daysrestriction === 'year' && diffYears <= periocity) {
|
|
89
|
+
const startDate = new Date(value['StartDate']);
|
|
90
|
+
if (
|
|
91
|
+
isLeptYear(startDate.getFullYear()) &&
|
|
92
|
+
startDate.getMonth() < 2 &&
|
|
93
|
+
diffDays <= 366
|
|
94
|
+
)
|
|
95
|
+
validValue = true;
|
|
96
|
+
else if (diffDays <= 365) validValue = true;
|
|
42
97
|
}
|
|
43
98
|
return validValue;
|
|
44
99
|
};
|