]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix snap schedule date format 55809/head
authorIvo Almeida <ialmeida@redhat.com>
Wed, 28 Feb 2024 09:53:57 +0000 (09:53 +0000)
committerIvo Almeida <ialmeida@redhat.com>
Wed, 28 Feb 2024 09:59:44 +0000 (09:59 +0000)
Fixes: https://tracker.ceph.com/issues/64613
Signed-off-by: Ivo Almeida <ialmeida@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-snapshotschedule-form/cephfs-snapshotschedule-form.component.ts

index d14d7debcce94db1ee1325fff75b1b56b0b16749..076c99014a6b7a65608fafa1f81c50d9dd8bd000 100644 (file)
@@ -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}`;