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

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,8 +2889,12 @@
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
@@ -2896,6 +2904,10 @@
2896
2904
  var date = moment$1(value, DATE_ISO_PATTERN);
2897
2905
  if (date.isValid())
2898
2906
  return date;
2907
+ // Parse the input value, as a date only
2908
+ var dateOnly = moment$1(value, DATE_PATTERN);
2909
+ if (dateOnly.isValid())
2910
+ return DateUtils.markNoTime(date);
2899
2911
  // Not valid: trying to convert from unix timestamp
2900
2912
  if (typeof value === 'string') {
2901
2913
  console.warn('Wrong date format - Trying to convert from local time: ' + value);
@@ -6274,7 +6286,7 @@
6274
6286
  var dayStr = this.dateAdapter.format(day, this.dayPattern);
6275
6287
  // Format time
6276
6288
  var timeStr = void 0;
6277
- if (date[MOMENT_NO_TIME_PROPERTY] === true) {
6289
+ if (DateUtils.isNoTime(date)) {
6278
6290
  // Clear time
6279
6291
  timeStr = null;
6280
6292
  }
@@ -34805,6 +34817,7 @@
34805
34817
  exports.CryptoService = CryptoService;
34806
34818
  exports.CsvUtils = CsvUtils;
34807
34819
  exports.DATE_ISO_PATTERN = DATE_ISO_PATTERN;
34820
+ exports.DATE_PATTERN = DATE_PATTERN;
34808
34821
  exports.DATE_UNIX_MS_TIMESTAMP = DATE_UNIX_MS_TIMESTAMP;
34809
34822
  exports.DATE_UNIX_TIMESTAMP = DATE_UNIX_TIMESTAMP;
34810
34823
  exports.DEFAULT_MENU_SHOW_WHEN = DEFAULT_MENU_SHOW_WHEN;