monkey-style-guide 2.0.90 → 2.0.91

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.
@@ -2306,6 +2306,10 @@
2306
2306
  this._daysArrFirst = this.createCalendar(this._dateFirst);
2307
2307
  this._daysArrSecond = this.createCalendar(this._dateSecond);
2308
2308
  };
2309
+ MonkeyDateRangePickerComponent.prototype.clearDates = function () {
2310
+ this._dateForm.setValue({ startDate: null, endDate: null });
2311
+ this.writeValue(this._dateForm.value);
2312
+ };
2309
2313
  MonkeyDateRangePickerComponent.prototype.navigateToToday = function () {
2310
2314
  this._dateFirst = moment();
2311
2315
  this._dateSecond = moment().add(1, 'M');
@@ -2385,17 +2389,24 @@
2385
2389
  var _dateForm = this._dateForm;
2386
2390
  var dayFormatted = day.format('YYYY-MM-DD');
2387
2391
  if (_dateForm.valid) {
2388
- _dateForm.setValue({ startDate: null, endDate: null });
2389
- this.writeValue(_dateForm.value);
2390
- return;
2392
+ this.clearDates();
2391
2393
  }
2392
- if (!_dateForm.get('startDate').value) {
2393
- _dateForm.get('startDate').patchValue(dayFormatted);
2394
+ var _a = _dateForm.value, startDate = _a.startDate, endDate = _a.endDate;
2395
+ if (startDate) {
2396
+ if (moment(startDate).isAfter(moment(dayFormatted))) {
2397
+ endDate = startDate;
2398
+ startDate = dayFormatted;
2399
+ }
2394
2400
  }
2395
- else {
2396
- _dateForm.get('endDate').patchValue(dayFormatted);
2397
- this.writeValue(_dateForm.value);
2401
+ else
2402
+ startDate = dayFormatted;
2403
+ if (startDate) {
2404
+ _dateForm.get('startDate').patchValue(startDate);
2405
+ }
2406
+ if (endDate) {
2407
+ _dateForm.get('endDate').patchValue(endDate);
2398
2408
  }
2409
+ this.writeValue(_dateForm.value);
2399
2410
  };
2400
2411
  MonkeyDateRangePickerComponent.prototype.selectRangeOfDays = function (days) {
2401
2412
  var _a = this, _dateForm = _a._dateForm, today = _a.today;