Skip to content

Commit a2942f0

Browse files
committed
mgr/dashboard: fix snap schedule time format
Fixes: https://tracker.ceph.com/issues/64831 Signed-off-by: Ivo Almeida <[email protected]>
1 parent c1ea979 commit a2942f0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-snapshotschedule-form/cephfs-snapshotschedule-form.component.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,17 @@ export class CephfsSnapshotscheduleFormComponent extends CdForm implements OnIni
222222
this.cd.detectChanges();
223223
}
224224

225+
convertNumberToString(input: number, length = 2, format = '0'): string {
226+
return padStart(input.toString(), length, format);
227+
}
228+
225229
parseDatetime(date: NgbDateStruct, time?: NgbTimeStruct): string {
226230
if (!date || !time) return null;
227-
return `${date.year}-${padStart(date.month.toString(), 2, '0')}-${padStart(
228-
date.day.toString(),
229-
2,
230-
'0'
231-
)}T${time.hour || '00'}:${time.minute || '00'}:${time.second || '00'}`;
231+
return `${date.year}-${this.convertNumberToString(date.month)}-${this.convertNumberToString(
232+
date.day
233+
)}T${this.convertNumberToString(time.hour)}:${this.convertNumberToString(
234+
time.minute
235+
)}:${this.convertNumberToString(time.second)}`;
232236
}
233237
parseSchedule(interval: number, frequency: string): string {
234238
return `${interval}${frequency}`;

0 commit comments

Comments
 (0)