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.
@@ -3202,7 +3202,6 @@ class CreateDashboardComponent {
3202
3202
  this.datePickerOverlay = true;
3203
3203
  }
3204
3204
  closeFromDatePicker() {
3205
- console.log("dayjs(dashboard.selectedFromDate).format('YYYY-MM-DD') ==>", this.dashboardForm, new Date(this.dashboardForm?.selectedFromDate));
3206
3205
  if (!this.dashboardForm.selectedFromDate) {
3207
3206
  this.dashboardForm.selectedToDate = undefined;
3208
3207
  this.hideToDate = true;
@@ -3214,7 +3213,6 @@ class CreateDashboardComponent {
3214
3213
  return;
3215
3214
  }
3216
3215
  let minToDate = this.setToDate(this.dashboardForm.selectedFromDate);
3217
- console.log("dayjs(dashboard.selectedFromDate).format('YYYY-MM-DD') ==>1", minToDate);
3218
3216
  this.toDatePickerConfig = { min: minToDate };
3219
3217
  const fromDate = new Date(minToDate.split('-').reverse().join('-'));
3220
3218
  const toDate = new Date(this.dashboardForm.selectedToDate);
@@ -3255,6 +3253,15 @@ class CreateDashboardComponent {
3255
3253
  let today = new Date(data);
3256
3254
  return today.getDate() + '-' + (today.getMonth() + 1) + '-' + today.getFullYear();
3257
3255
  }
3256
+ /**
3257
+ * It takes a string, converts it to a date, then returns a string in the format of YYYY-MM-DD.
3258
+ * @param {string} data - the date you want to format
3259
+ * @returns A string in the format of YYYY-MM-DD
3260
+ */
3261
+ getDateFormate(data) {
3262
+ let today = new Date(data);
3263
+ return today.getFullYear() + '-' + String((today.getMonth() + 1)).padStart(2, '0') + '-' + String(today.getDate()).padStart(2, '0');
3264
+ }
3258
3265
  configureDashboard() {
3259
3266
  let fieldsStatus = this.validateDashboard();
3260
3267
  if (fieldsStatus) {
@@ -3699,10 +3706,6 @@ class CreateDashboardComponent {
3699
3706
  }
3700
3707
  this.vLoader = true;
3701
3708
  const dashboard = this.dashboardForm;
3702
- console.log("dayjs(dashboard.selectedFromDate).format('YYYY-MM-DD')", dashboard, new Date(dashboard?.selectedFromDate));
3703
- // console.log("dayjs(dashboard.selectedFromDate).format('YYYY-MM-DD') 123",dayjs(dashboard?.selectedFromDate).format('YYYY-MM-DD'))
3704
- console.log("dayjs(dashboard.selectedFromDate).format('YYYY-MM-DD') checking ", this.mode);
3705
- console.log("dayjs(dashboard.selectedFromDate).format('YYYY-MM-DD') checking 0", dayjs(new Date(dashboard?.selectedFromDate)).format('YYYY-MM-DD'));
3706
3709
  const payload = {
3707
3710
  dashboard_name: dashboard.dashboardName,
3708
3711
  description: [
@@ -3718,13 +3721,12 @@ class CreateDashboardComponent {
3718
3721
  risk_category: this.returnIds(dashboard.selectedRiskCategories, 'category_id'),
3719
3722
  display_criteria: (dashboard.displayCriteria === 'and') ? 'BOTH_RC_AND_CATEGORY' : 'RC_OR_CATEGORY',
3720
3723
  timeframe: {
3721
- start_date: (dashboard.selectedFromDate) ? dayjs(new Date(dashboard?.selectedFromDate)).format('YYYY-MM-DD') : '',
3722
- end_date: (dashboard.selectedToDate) ? dayjs(new Date(dashboard?.selectedToDate)).format('YYYY-MM-DD') : '',
3724
+ start_date: (dashboard.selectedFromDate) ? this.getDateFormate(dashboard?.selectedFromDate) : '',
3725
+ end_date: (dashboard.selectedToDate) ? this.getDateFormate(dashboard?.selectedToDate) : '',
3723
3726
  },
3724
3727
  email_summary: this.setFrequency('', 'export'),
3725
3728
  widget_details: dashboard.configureWidget
3726
3729
  };
3727
- console.log("dayjs(dashboard.selectedFromDate).format('YYYY-MM-DD') checking 1", this.mode);
3728
3730
  if (this.mode == 'CREATE') {
3729
3731
  this.createDashboardService.submitDashboard(payload).subscribe((res) => {
3730
3732
  this.vLoader = false;