@eeacms/volto-clms-theme 1.1.263 → 1.1.264

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,8 @@ 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.264](https://github.com/eea/volto-clms-theme/compare/1.1.263...1.1.264) - 11 December 2025
8
+
7
9
  ### [1.1.263](https://github.com/eea/volto-clms-theme/compare/1.1.262...1.1.263) - 10 December 2025
8
10
 
9
11
  ### [1.1.262](https://github.com/eea/volto-clms-theme/compare/1.1.261...1.1.262) - 13 November 2025
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.263",
3
+ "version": "1.1.264",
4
4
  "description": "volto-clms-theme: Volto theme for CLMS site",
5
5
  "main": "src/index.js",
6
6
  "author": "CodeSyntax for the European Environment Agency",
@@ -4,7 +4,10 @@ import { Grid, Popup } from 'semantic-ui-react';
4
4
  import calendarSVG from '@plone/volto/icons/calendar.svg';
5
5
  import { Icon } from '@plone/volto/components';
6
6
 
7
- import { cclDateFormat } from '@eeacms/volto-clms-theme/components/CclUtils';
7
+ import {
8
+ cclCartDateFormat,
9
+ toUTCTimestamp,
10
+ } from '@eeacms/volto-clms-theme/components/CclUtils';
8
11
  import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
9
12
 
10
13
  export const TimeseriesPicker = (props) => {
@@ -18,12 +21,12 @@ export const TimeseriesPicker = (props) => {
18
21
  } = props;
19
22
  const [startValue, setStartValue] = useState(
20
23
  item?.TemporalFilter?.StartDate
21
- ? new Date(cclDateFormat(item.TemporalFilter.StartDate))
24
+ ? new Date(cclCartDateFormat(item.TemporalFilter.StartDate))
22
25
  : null,
23
26
  );
24
27
  const [endValue, setEndValue] = useState(
25
28
  item?.TemporalFilter?.EndDate
26
- ? new Date(cclDateFormat(item.TemporalFilter.EndDate))
29
+ ? new Date(cclCartDateFormat(item.TemporalFilter.EndDate))
27
30
  : null,
28
31
  );
29
32
  const [isOpen, setIsOpen] = useState(false);
@@ -62,9 +65,9 @@ export const TimeseriesPicker = (props) => {
62
65
  <br />
63
66
  <span>
64
67
  {item.TemporalFilter
65
- ? `${cclDateFormat(
68
+ ? `${cclCartDateFormat(
66
69
  item.TemporalFilter.StartDate,
67
- )}-${cclDateFormat(item.TemporalFilter.EndDate)}`
70
+ )}-${cclCartDateFormat(item.TemporalFilter.EndDate)}`
68
71
  : 'Select dates'}
69
72
  </span>
70
73
  </button>
@@ -125,9 +128,9 @@ export const TimeseriesPicker = (props) => {
125
128
  {(item?.TemporalFilter?.StartDate ||
126
129
  item?.TemporalFilter?.EndDate) && (
127
130
  <span>
128
- {cclDateFormat(item?.TemporalFilter?.StartDate)} -{' '}
131
+ {cclCartDateFormat(item?.TemporalFilter?.StartDate)} -{' '}
129
132
  {item?.TemporalFilter?.EndDate &&
130
- cclDateFormat(item?.TemporalFilter?.EndDate)}
133
+ cclCartDateFormat(item?.TemporalFilter?.EndDate)}
131
134
  </span>
132
135
  )}
133
136
  <br />
@@ -192,12 +195,12 @@ export const TimeseriesPicker = (props) => {
192
195
  }
193
196
  onClick={() => {
194
197
  item.TemporalFilter = {
195
- StartDate: startValue,
196
- EndDate: endValue,
198
+ StartDate: toUTCTimestamp(startValue, false),
199
+ EndDate: toUTCTimestamp(endValue, true),
197
200
  };
198
201
  setTimeseriesValue(item.unique_id, {
199
- StartDate: startValue,
200
- EndDate: endValue,
202
+ StartDate: toUTCTimestamp(startValue, false),
203
+ EndDate: toUTCTimestamp(endValue, true),
201
204
  });
202
205
  setIsOpen(false);
203
206
  }}
@@ -61,10 +61,8 @@ export const getDownloadToolPostBody = (selectedItems) => {
61
61
  body_extras['Layer'] = item?.layer;
62
62
  }
63
63
  if (item?.TemporalFilter) {
64
- body_extras['TemporalFilter'] = {
65
- StartDate: new Date(item?.TemporalFilter?.StartDate).getTime(),
66
- EndDate: new Date(item?.TemporalFilter?.EndDate).getTime(),
67
- };
64
+ // TemporalFilter now contains UTC timestamps directly
65
+ body_extras['TemporalFilter'] = item.TemporalFilter;
68
66
  }
69
67
  }
70
68
  return { DatasetID: item?.dataset_uid, ...body_extras };
@@ -30,6 +30,15 @@ export const cclDateFormat = (date) => {
30
30
  return `${day}.${month}.${year}`;
31
31
  };
32
32
 
33
+ export const cclCartDateFormat = (date) => {
34
+ const dateObj = new Date(date);
35
+ // Use UTC methods to ensure consistent display regardless of user timezone
36
+ const day = ('0' + dateObj.getUTCDate()).slice(-2);
37
+ const month = ('0' + (dateObj.getUTCMonth() + 1)).slice(-2);
38
+ const year = dateObj.getUTCFullYear();
39
+ return `${day}.${month}.${year}`;
40
+ };
41
+
33
42
  export const workOpportunitiesCclDateFormat = (date, lang) => {
34
43
  const internal = getInternalValue(date, lang);
35
44
  return internal.format('DD.MM.YYYY');
@@ -41,3 +50,26 @@ export const cclTimeFormat = (date) => {
41
50
  const minutes = ('0' + dateObj.getMinutes()).slice(-2);
42
51
  return `${hours}.${minutes}`;
43
52
  };
53
+
54
+ /**
55
+ * Convert a Date object to UTC timestamp, preserving the calendar date
56
+ * regardless of the user's timezone.
57
+ *
58
+ * @param {Date} date - The date to convert
59
+ * @param {boolean} isEndOfDay - If true, set time to 23:59:59.999, otherwise 00:00:00.000
60
+ * @returns {number|null} UTC timestamp in milliseconds, or null if date is falsy
61
+ */
62
+ export const toUTCTimestamp = (date, isEndOfDay = false) => {
63
+ if (!date) return null;
64
+
65
+ // Adjust for timezone offset to get the intended UTC date
66
+ const offsetDate = new Date(
67
+ date.getTime() - date.getTimezoneOffset() * 60000,
68
+ );
69
+
70
+ if (isEndOfDay) {
71
+ offsetDate.setUTCHours(23, 59, 59, 999);
72
+ }
73
+
74
+ return offsetDate.getTime();
75
+ };
@@ -9,6 +9,8 @@ export {
9
9
  cclDateFormat,
10
10
  cclDateTimeFormat,
11
11
  cclTimeFormat,
12
+ cclCartDateFormat,
13
+ toUTCTimestamp,
12
14
  } from './dateFormats';
13
15
  export { helmetTitle } from './helmetTitle';
14
16
  export { sanitizedHTML } from './sanitizedHTML';