@mcurros2/microm 1.1.149-0 → 1.1.150-0

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.js CHANGED
@@ -805,31 +805,23 @@ function $da685baa3bcc0ab0$export$f901ae239e30212a(columnName, sourceValue, colu
805
805
  valueDescriptionToSet = sourceValue.valueDescription;
806
806
  } else valueToSet = sourceValue;
807
807
  // Convert string to Date if necessary
808
- if ((0, $lTNXP.isIn)(column.type, "date", "datetime", "datetime2", "smalldatetime") && typeof valueToSet === "string" && !(0, $lTNXP.isIn)(columnName, "dt_lu")) try {
809
- let dateValue;
810
- // FIX to handle dayjs issue parsions string ISO 8601 with trimed zeroes ate the end of the millisconds
811
- // 2025-07-02T16:58:45.57 57 here means 570 millisecons buy dayJS has a bug and parses it as 57 milliseconds
808
+ if ((0, $lTNXP.isIn)(column.type, "date", "datetime", "datetime2", "smalldatetime") && typeof valueToSet === "string" && !(0, $lTNXP.isIn)(columnName, "dt_lu")) {
812
809
  try {
813
- if (valueToSet.indexOf("Z") === -1 && valueToSet.length === 22) {
814
- dateValue = new Date(valueToSet);
815
- if (isNaN(dateValue.getTime())) dateValue = null; // Invalid date
816
- if (dateValue !== null) {
817
- let new_value = valueToSet;
818
- new_value = dateValue.toISOString();
819
- if (new_value.endsWith("Z")) valueToSet = new_value.slice(0, -1);
820
- }
821
- }
822
- } catch (_a) {}
823
- // dayjs is used here for compatibility with mantine calendar component which formats the date with dayjs
824
- valueToSet = (0, ($parcel$interopDefault($b4te3$dayjs)))(valueToSet).toDate();
825
- } catch (e) {
826
- console.log(`Error converting string to Date: ${e}`, e);
810
+ // FIX to handle dayjs issue parsing string ISO 8601 with trimmed zeroes at the end of the milliseconds
811
+ // 2025-07-02T16:58:45.57 57 here means 570 milliseconds but dayJS has a bug and parses it as 57 milliseconds
812
+ const endsWithDotAndTwoDigits = /\.\d{2}$/;
813
+ if (valueToSet.length === 22 && endsWithDotAndTwoDigits.test(valueToSet)) valueToSet = valueToSet + "0"; // add the missing zero to milliseconds
814
+ // dayjs is used here for compatibility with mantine calendar component which formats the date with dayjs
815
+ valueToSet = (0, ($parcel$interopDefault($b4te3$dayjs)))(valueToSet).toDate();
816
+ } catch (e) {
817
+ console.log(`Error converting string to Date: ${e}`, e);
818
+ }
819
+ if (!(0, $eRkDL.hasValue)(valueToSet) && ignoreEmptySourceValues) return;
820
+ // MMC: specific for entityAPI getData method, where the json array comes as an escaped string
821
+ if (convertStringArray && column.isArray && typeof valueToSet === "string") column.value = JSON.parse(valueToSet);
822
+ else column.value = valueToSet;
823
+ if (valueDescriptionToSet) column.valueDescription = valueDescriptionToSet;
827
824
  }
828
- if (!(0, $eRkDL.hasValue)(valueToSet) && ignoreEmptySourceValues) return;
829
- // MMC: specific for entityAPI getData method, where the json array comes as an escaped string
830
- if (convertStringArray && column.isArray && typeof valueToSet === "string") column.value = JSON.parse(valueToSet);
831
- else column.value = valueToSet;
832
- if (valueDescriptionToSet) column.valueDescription = valueDescriptionToSet;
833
825
  }
834
826
  function $da685baa3bcc0ab0$export$b7771d60d308862f(columns, sourceValues, filters, ignoreInexistentColumns = false, ignoreEmptySourceValues = false, convertStringArray = false) {
835
827
  if (!sourceValues) return;