@sumaris-net/ngx-components 1.22.12-rc1 → 1.22.12-rc4

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.
@@ -41,6 +41,7 @@
41
41
  }());
42
42
 
43
43
  var DATE_ISO_PATTERN = 'YYYY-MM-DDTHH:mm:ss.SSSZ';
44
+ var DATE_PATTERN = 'YYYY-MM-DD';
44
45
  var DEFAULT_PLACEHOLDER_CHAR = '\u005F';
45
46
  var PUBKEY_REGEXP = /^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{43,44}$/;
46
47
  var SPACE_PLACEHOLDER_CHAR = '\u2000';
@@ -2856,6 +2857,9 @@
2856
2857
  value[MOMENT_NO_TIME_PROPERTY] = true;
2857
2858
  return value;
2858
2859
  };
2860
+ DateUtils.isNoTime = function (value) {
2861
+ return (value === null || value === void 0 ? void 0 : value[MOMENT_NO_TIME_PROPERTY]) === true;
2862
+ };
2859
2863
  /**
2860
2864
  * Test if a date is on the given day of week
2861
2865
  * @param date
@@ -2885,13 +2889,23 @@
2885
2889
  return value;
2886
2890
  }
2887
2891
  // Make sure to have a Moment object
2888
- value = fromDateISOString(value);
2889
- return value && value.toISOString() || undefined;
2892
+ var date = fromDateISOString(value);
2893
+ if (!date)
2894
+ return undefined;
2895
+ return DateUtils.isNoTime(date)
2896
+ ? date.toISOString(true /* important ! */).substr(0, 10)
2897
+ : date.toISOString();
2890
2898
  }
2891
2899
  function fromDateISOString(value) {
2892
2900
  // Already a moment object: use it
2893
2901
  if (!value || momentImported.isMoment(value))
2894
2902
  return value;
2903
+ if (typeof value === 'string' && value.length === 10) {
2904
+ // Parse the input value, as a date only
2905
+ var dateOnly = moment$1(value, DATE_PATTERN);
2906
+ if (dateOnly.isValid())
2907
+ return DateUtils.markNoTime(dateOnly);
2908
+ }
2895
2909
  // Parse the input value, as a ISO date time
2896
2910
  var date = moment$1(value, DATE_ISO_PATTERN);
2897
2911
  if (date.isValid())
@@ -6274,7 +6288,7 @@
6274
6288
  var dayStr = this.dateAdapter.format(day, this.dayPattern);
6275
6289
  // Format time
6276
6290
  var timeStr = void 0;
6277
- if (date[MOMENT_NO_TIME_PROPERTY] === true) {
6291
+ if (DateUtils.isNoTime(date)) {
6278
6292
  // Clear time
6279
6293
  timeStr = null;
6280
6294
  }
@@ -34805,6 +34819,7 @@
34805
34819
  exports.CryptoService = CryptoService;
34806
34820
  exports.CsvUtils = CsvUtils;
34807
34821
  exports.DATE_ISO_PATTERN = DATE_ISO_PATTERN;
34822
+ exports.DATE_PATTERN = DATE_PATTERN;
34808
34823
  exports.DATE_UNIX_MS_TIMESTAMP = DATE_UNIX_MS_TIMESTAMP;
34809
34824
  exports.DATE_UNIX_TIMESTAMP = DATE_UNIX_TIMESTAMP;
34810
34825
  exports.DEFAULT_MENU_SHOW_WHEN = DEFAULT_MENU_SHOW_WHEN;