@bpmn-io/form-js-viewer 1.8.8 → 1.9.1

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/dist/index.es.js CHANGED
@@ -6,6 +6,7 @@ import { jsx, jsxs, Fragment } from 'preact/jsx-runtime';
6
6
  import { useContext, useMemo, useRef, useCallback, useEffect, useState, useLayoutEffect } from 'preact/hooks';
7
7
  import { createContext, createElement, Fragment as Fragment$1, render } from 'preact';
8
8
  import isEqual from 'lodash/isEqual';
9
+ import { DateTime } from 'luxon';
9
10
  import flatpickr from 'flatpickr';
10
11
  import * as React from 'preact/compat';
11
12
  import { createPortal } from 'preact/compat';
@@ -1418,16 +1419,16 @@ function parseIsoTime(isoTimeString) {
1418
1419
  return parseBasicMinutes(isoTimeString);
1419
1420
  }
1420
1421
  }
1422
+
1423
+ /**
1424
+ * Returns the date object as a simple 'YYYY-MM-DD' formatted date in the local timezone.
1425
+ *
1426
+ * @param {*} date The date object to serialize.
1427
+ * @returns {string} The serialized date.
1428
+ */
1421
1429
  function serializeDate(date) {
1422
- var d = new Date(date),
1423
- month = '' + (d.getMonth() + 1),
1424
- day = '' + d.getDate(),
1425
- year = d.getFullYear();
1426
- if (month.length < 2) month = '0' + month;
1427
- if (day.length < 2) day = '0' + day;
1428
- return [year, month, day].join('-');
1430
+ return DateTime.fromJSDate(date).toISODate();
1429
1431
  }
1430
-
1431
1432
  // this method is used to make the `new Date(value)` parsing behavior stricter
1432
1433
  function isDateTimeInputInformationSufficient(value) {
1433
1434
  if (!value || typeof value !== 'string') return false;
@@ -2847,7 +2848,7 @@ function Datetime(props) {
2847
2848
  switch (subtype) {
2848
2849
  case DATETIME_SUBTYPES.DATE:
2849
2850
  {
2850
- date = new Date(Date.parse(value));
2851
+ date = typeof value === 'string' ? DateTime.fromISO(value).toJSDate() : new Date(NaN);
2851
2852
  break;
2852
2853
  }
2853
2854
  case DATETIME_SUBTYPES.TIME: