@datarailsshared/datarailsshared 1.4.183 → 1.4.184

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.
@@ -450,10 +450,13 @@
450
450
  this.updateLockedDate();
451
451
  };
452
452
  ForecastTagComponent.prototype.updateYear = function (fiscalYear, month) {
453
- this.dateObj.date = fiscalYear ? moment$8((month || '01') + "/01/" + fiscalYear + " 12:00:00", 'MM/DD/YYYY hh:mm:ss').utc().unix() : moment$8.utc().unix();
453
+ var MONTH_DIFF = 1;
454
+ this.dateObj.date = fiscalYear
455
+ ? moment$8((month + MONTH_DIFF || '01') + "/01/" + fiscalYear + " 12:00:00", 'MM/DD/YYYY hh:mm:ss').utc().unix()
456
+ : moment$8.utc().unix();
454
457
  };
455
458
  ForecastTagComponent.prototype.updateLockedDate = function () {
456
- var e_1, _a;
459
+ var e_1, _b;
457
460
  var year = moment$8.unix(this.dateObj.date).year();
458
461
  var _loop_1 = function (forecastTag) {
459
462
  forecastTag.disabled = this_1.lockedDate.some(function (timestamp) {
@@ -463,15 +466,15 @@
463
466
  };
464
467
  var this_1 = this;
465
468
  try {
466
- for (var _b = __values(this.forecastTags), _c = _b.next(); !_c.done; _c = _b.next()) {
467
- var forecastTag = _c.value;
469
+ for (var _c = __values(this.forecastTags), _d = _c.next(); !_d.done; _d = _c.next()) {
470
+ var forecastTag = _d.value;
468
471
  _loop_1(forecastTag);
469
472
  }
470
473
  }
471
474
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
472
475
  finally {
473
476
  try {
474
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
477
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
475
478
  }
476
479
  finally { if (e_1) throw e_1.error; }
477
480
  }
@@ -505,14 +508,6 @@
505
508
  }
506
509
  return fiscal_year;
507
510
  };
508
- ForecastTagComponent.prototype.getForecastLabelFromValue = function (value, fiscal_year_starts_from, fiscal_year_back) {
509
- if (!value)
510
- return '';
511
- var dateObj = moment$8.unix(value);
512
- var fiscal_month = this.getFiscalMonthFromDate(dateObj, fiscal_year_starts_from);
513
- var fiscal_year = this.getFiscalYearFromDate(dateObj, fiscal_year_starts_from, fiscal_year_back);
514
- return fiscal_month + "+" + (12 - fiscal_month) + " (" + fiscal_year + ")";
515
- };
516
511
  ForecastTagComponent.prototype.changeTagInputHandler = function (event) {
517
512
  this.chosenTagHandler();
518
513
  };
@@ -522,26 +517,26 @@
522
517
  };
523
518
  ForecastTagComponent.prototype.chosenTagHandler = function () {
524
519
  var _this = this;
520
+ var _a;
525
521
  if (this.isDateEventHappened)
526
522
  return;
527
523
  var month = this.forecastValue;
528
524
  var year = moment$8.unix(this.dateObj.date).year();
529
- var label = '';
530
525
  if (!Number.isNaN(month) && !Number.isNaN(year)) {
531
- var date = moment$8(month + "/01/" + year + " 12:00:00", 'MM/DD/YYYY hh:mm:ss');
526
+ var date = new Date(year, month, 1, 12, 0, 0, 0);
532
527
  var fiscal_year_starts_from = this.fiscalYearStartsFrom || 1;
533
528
  var fiscal_year_back = this.fiscalYearBack || false;
534
529
  if (fiscal_year_starts_from !== 1) {
535
530
  if (!fiscal_year_back) {
536
- date.set('month', date.month() - 13 + fiscal_year_starts_from);
531
+ date.setMonth(date.getMonth() - 13 + fiscal_year_starts_from);
537
532
  }
538
533
  else {
539
- date.set('month', date.month() - 1 + fiscal_year_starts_from);
534
+ date.setMonth(date.getMonth() - 1 + fiscal_year_starts_from);
540
535
  }
541
536
  }
542
- label = this.getForecastLabelFromValue(date.unix(), fiscal_year_starts_from, fiscal_year_back);
543
- var fiscal_year = this.getFiscalYearFromDate(date, fiscal_year_starts_from, fiscal_year_back);
544
- this.updateYear(fiscal_year, month);
537
+ var momentDate = moment$8.unix(date.getTime() / 1000);
538
+ var fiscal_year = this.getFiscalYearFromDate(momentDate, fiscal_year_starts_from, fiscal_year_back);
539
+ this.updateYear(fiscal_year, date.getMonth());
545
540
  this.isDateEventHappened = true;
546
541
  setTimeout(function () {
547
542
  _this.isDateEventHappened = false;
@@ -550,7 +545,7 @@
550
545
  var resultTag = {
551
546
  name: this.name,
552
547
  value: this.dateObj.date,
553
- label: label,
548
+ label: (_a = _.find(this.forecastTags, { value: this.forecastValue })) === null || _a === void 0 ? void 0 : _a.label,
554
549
  locked: !this.dateFilter(moment$8.unix(this.dateObj.date))
555
550
  };
556
551
  this.dateChange.emit(resultTag);