vc-create-dashboard 2.8.18 → 2.8.20

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.
@@ -3226,8 +3226,7 @@ class CreateDashboardComponent {
3226
3226
  this.datePickerOverlay = true;
3227
3227
  }
3228
3228
  closeFromDatePicker() {
3229
- var _a, _b, _c;
3230
- console.log("dayjs(dashboard.selectedFromDate).format('YYYY-MM-DD') ==>", this.dashboardForm, new Date((_a = this.dashboardForm) === null || _a === void 0 ? void 0 : _a.selectedFromDate));
3229
+ var _a, _b;
3231
3230
  if (!this.dashboardForm.selectedFromDate) {
3232
3231
  this.dashboardForm.selectedToDate = undefined;
3233
3232
  this.hideToDate = true;
@@ -3239,7 +3238,6 @@ class CreateDashboardComponent {
3239
3238
  return;
3240
3239
  }
3241
3240
  let minToDate = this.setToDate(this.dashboardForm.selectedFromDate);
3242
- console.log("dayjs(dashboard.selectedFromDate).format('YYYY-MM-DD') ==>1", minToDate);
3243
3241
  this.toDatePickerConfig = { min: minToDate };
3244
3242
  const fromDate = new Date(minToDate.split('-').reverse().join('-'));
3245
3243
  const toDate = new Date(this.dashboardForm.selectedToDate);
@@ -3251,7 +3249,7 @@ class CreateDashboardComponent {
3251
3249
  this.hideToDate = false;
3252
3250
  }, 20);
3253
3251
  }
3254
- (_c = (_b = this.fromDatePicker) === null || _b === void 0 ? void 0 : _b.api) === null || _c === void 0 ? void 0 : _c.close();
3252
+ (_b = (_a = this.fromDatePicker) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.close();
3255
3253
  this.datePickerOverlay = false;
3256
3254
  }
3257
3255
  closeToDatePicker() {
@@ -3281,6 +3279,15 @@ class CreateDashboardComponent {
3281
3279
  let today = new Date(data);
3282
3280
  return today.getDate() + '-' + (today.getMonth() + 1) + '-' + today.getFullYear();
3283
3281
  }
3282
+ /**
3283
+ * It takes a string, converts it to a date, then returns a string in the format of YYYY-MM-DD.
3284
+ * @param {string} data - the date you want to format
3285
+ * @returns A string in the format of YYYY-MM-DD
3286
+ */
3287
+ getDateFormate(data) {
3288
+ let today = new Date(data);
3289
+ return today.getFullYear() + '-' + String((today.getMonth() + 1)).padStart(2, '0') + '-' + String(today.getDate()).padStart(2, '0');
3290
+ }
3284
3291
  configureDashboard() {
3285
3292
  let fieldsStatus = this.validateDashboard();
3286
3293
  if (fieldsStatus) {
@@ -3729,10 +3736,6 @@ class CreateDashboardComponent {
3729
3736
  }
3730
3737
  this.vLoader = true;
3731
3738
  const dashboard = this.dashboardForm;
3732
- console.log("dayjs(dashboard.selectedFromDate).format('YYYY-MM-DD')", dashboard, new Date(dashboard === null || dashboard === void 0 ? void 0 : dashboard.selectedFromDate));
3733
- // console.log("dayjs(dashboard.selectedFromDate).format('YYYY-MM-DD') 123",dayjs(dashboard?.selectedFromDate).format('YYYY-MM-DD'))
3734
- console.log("dayjs(dashboard.selectedFromDate).format('YYYY-MM-DD') checking ", this.mode);
3735
- console.log("dayjs(dashboard.selectedFromDate).format('YYYY-MM-DD') checking 0", dayjs(new Date(dashboard === null || dashboard === void 0 ? void 0 : dashboard.selectedFromDate)).format('YYYY-MM-DD'));
3736
3739
  const payload = {
3737
3740
  dashboard_name: dashboard.dashboardName,
3738
3741
  description: [
@@ -3748,13 +3751,12 @@ class CreateDashboardComponent {
3748
3751
  risk_category: this.returnIds(dashboard.selectedRiskCategories, 'category_id'),
3749
3752
  display_criteria: (dashboard.displayCriteria === 'and') ? 'BOTH_RC_AND_CATEGORY' : 'RC_OR_CATEGORY',
3750
3753
  timeframe: {
3751
- start_date: (dashboard.selectedFromDate) ? dayjs(new Date(dashboard === null || dashboard === void 0 ? void 0 : dashboard.selectedFromDate)).format('YYYY-MM-DD') : '',
3752
- end_date: (dashboard.selectedToDate) ? dayjs(new Date(dashboard === null || dashboard === void 0 ? void 0 : dashboard.selectedToDate)).format('YYYY-MM-DD') : '',
3754
+ start_date: (dashboard.selectedFromDate) ? this.getDateFormate(dashboard === null || dashboard === void 0 ? void 0 : dashboard.selectedFromDate) : '',
3755
+ end_date: (dashboard.selectedToDate) ? this.getDateFormate(dashboard === null || dashboard === void 0 ? void 0 : dashboard.selectedToDate) : '',
3753
3756
  },
3754
3757
  email_summary: this.setFrequency('', 'export'),
3755
3758
  widget_details: dashboard.configureWidget
3756
3759
  };
3757
- console.log("dayjs(dashboard.selectedFromDate).format('YYYY-MM-DD') checking 1", this.mode);
3758
3760
  if (this.mode == 'CREATE') {
3759
3761
  this.createDashboardService.submitDashboard(payload).subscribe((res) => {
3760
3762
  this.vLoader = false;