@eternalcodestudio/primeng-table 19.1.0 → 19.1.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.
@@ -789,8 +789,14 @@ class TableCell {
789
789
  const effectiveTimezone = dateTimezone ?? this.dateTimezone;
790
790
  const effectiveCulture = dateCulture ?? this.dateCulture;
791
791
  if (value) { // If value is not undefined
792
- const dateUtc = new Date(value + 'Z'); // Make sure the date is treated as UTC
793
- formattedDate = this.datePipe.transform(dateUtc, effectiveFormat, effectiveTimezone, effectiveCulture); // Perform the date masking
792
+ let dateToParse = value;
793
+ if (typeof value === 'string' && !value.endsWith('Z') && !/[+-]\d{2}:\d{2}$/.test(value)) { // Check if the date does not contain Z
794
+ dateToParse += 'Z';
795
+ }
796
+ const dateUtc = new Date(dateToParse);
797
+ if (!isNaN(dateUtc.getTime())) { // Check that the date is valid before performing transformation
798
+ formattedDate = this.datePipe.transform(dateUtc, effectiveFormat, effectiveTimezone, effectiveCulture); // Perform the date masking
799
+ }
794
800
  }
795
801
  return formattedDate ?? ''; // Returns the date formatted, or as empty string if an issue was found (or value was undefined).
796
802
  }