configure typescript + begin conversion
This commit is contained in:
1 parent
3c71e0c7b2
commit
ea6fd94962
14 files changed
+381
-128
No files matched your search
@@ -0,0 +1,12 @@
|
||||
|
||||
export default function formatTime(d: string | Date | null | undefined): string {
|
||||
if (!d) return "Heure inconnue";
|
||||
|
||||
const date = d instanceof Date ? d : new Date(d);
|
||||
if (isNaN(date.getTime())) return "Heure invalide";
|
||||
|
||||
const hh = String(date.getUTCHours()).padStart(2, "0");
|
||||
const min = String(date.getUTCMinutes()).padStart(2, "0");
|
||||
|
||||
return `${hh}:${min}`;
|
||||
}
|
||||
Reference in new issue
Block a user