From 11fdcf800b14b5edbd2c02f2a6cfac72d174b3e9 Mon Sep 17 00:00:00 2001 From: Ivo Almeida Date: Wed, 28 Feb 2024 09:53:57 +0000 Subject: [PATCH] mgr/dashboard: fix snap schedule date format Fixes: https://tracker.ceph.com/issues/64613 Signed-off-by: Ivo Almeida --- .../cephfs-snapshotschedule-form.component.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-snapshotschedule-form/cephfs-snapshotschedule-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-snapshotschedule-form/cephfs-snapshotschedule-form.component.ts index d14d7debcce94..076c99014a6b7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-snapshotschedule-form/cephfs-snapshotschedule-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-snapshotschedule-form/cephfs-snapshotschedule-form.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectorRef, Component, OnInit } from '@angular/core'; import { AbstractControl, FormArray, FormControl, FormGroup, Validators } from '@angular/forms'; import { NgbActiveModal, NgbDateStruct, NgbTimeStruct } from '@ng-bootstrap/ng-bootstrap'; -import { uniq } from 'lodash'; +import { padStart, uniq } from 'lodash'; import { Observable, OperatorFunction, of, timer } from 'rxjs'; import { catchError, debounceTime, distinctUntilChanged, map, switchMap } from 'rxjs/operators'; import { CephfsSnapshotScheduleService } from '~/app/shared/api/cephfs-snapshot-schedule.service'; @@ -224,9 +224,11 @@ export class CephfsSnapshotscheduleFormComponent extends CdForm implements OnIni parseDatetime(date: NgbDateStruct, time?: NgbTimeStruct): string { if (!date || !time) return null; - return `${date.year}-${date.month}-${date.day}T${time.hour || '00'}:${time.minute || '00'}:${ - time.second || '00' - }`; + return `${date.year}-${padStart(date.month.toString(), 2, '0')}-${padStart( + date.day.toString(), + 2, + '0' + )}T${time.hour || '00'}:${time.minute || '00'}:${time.second || '00'}`; } parseSchedule(interval: number, frequency: string): string { return `${interval}${frequency}`; -- 2.39.5