From a2942f01ae9bde76c6d562374a0bd8aceeee317e Mon Sep 17 00:00:00 2001 From: Ivo Almeida Date: Mon, 11 Mar 2024 15:09:57 +0000 Subject: [PATCH] mgr/dashboard: fix snap schedule time format Fixes: https://tracker.ceph.com/issues/64831 Signed-off-by: Ivo Almeida --- .../cephfs-snapshotschedule-form.component.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 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 076c99014a6b7..0ef68f7d529c5 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 @@ -222,13 +222,17 @@ export class CephfsSnapshotscheduleFormComponent extends CdForm implements OnIni this.cd.detectChanges(); } + convertNumberToString(input: number, length = 2, format = '0'): string { + return padStart(input.toString(), length, format); + } + parseDatetime(date: NgbDateStruct, time?: NgbTimeStruct): string { if (!date || !time) return null; - 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'}`; + return `${date.year}-${this.convertNumberToString(date.month)}-${this.convertNumberToString( + date.day + )}T${this.convertNumberToString(time.hour)}:${this.convertNumberToString( + time.minute + )}:${this.convertNumberToString(time.second)}`; } parseSchedule(interval: number, frequency: string): string { return `${interval}${frequency}`; -- 2.39.5