Initial TicketTracker release
This commit is contained in:
commit
125b1d22ff
128 files changed
+26208
No files matched your search
@@ -0,0 +1,59 @@
|
||||
export function formatTimer(totalSeconds: number) {
|
||||
const hours = Math.floor(totalSeconds / 3600);
|
||||
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
||||
const seconds = totalSeconds % 60;
|
||||
|
||||
return [hours, minutes, seconds].map((part) => String(part).padStart(2, "0")).join(":");
|
||||
}
|
||||
|
||||
export function formatMinutes(minutes: number) {
|
||||
const hours = Math.floor(minutes / 60);
|
||||
const rest = minutes % 60;
|
||||
|
||||
if (hours === 0) {
|
||||
return `${rest} min`;
|
||||
}
|
||||
|
||||
if (rest === 0) {
|
||||
return `${hours} h`;
|
||||
}
|
||||
|
||||
return `${hours} h ${rest} min`;
|
||||
}
|
||||
|
||||
export function formatDateTime(value: string) {
|
||||
return new Intl.DateTimeFormat("de-DE", {
|
||||
dateStyle: "medium",
|
||||
timeStyle: "short"
|
||||
}).format(new Date(value));
|
||||
}
|
||||
|
||||
export function formatDate(value: string) {
|
||||
return new Intl.DateTimeFormat("de-DE", {
|
||||
weekday: "long",
|
||||
day: "2-digit",
|
||||
month: "2-digit",
|
||||
year: "numeric"
|
||||
}).format(new Date(value));
|
||||
}
|
||||
|
||||
export function formatTime(value: string) {
|
||||
return new Intl.DateTimeFormat("de-DE", {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit"
|
||||
}).format(new Date(value));
|
||||
}
|
||||
|
||||
export function formatTimeRange(start: string, end: string) {
|
||||
return `${formatTime(start)} - ${formatTime(end)}`;
|
||||
}
|
||||
|
||||
export function currentMonth() {
|
||||
const now = new Date();
|
||||
return `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}`;
|
||||
}
|
||||
|
||||
export function currentDay() {
|
||||
const now = new Date();
|
||||
return `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
|
||||
}
|
||||
Reference in new issue
Block a user