accept string and date in toLocalDate() util

This commit is contained in:
2025-11-10 16:09:53 +01:00
parent b03ae2b3de
commit 67a0ef2180
7 changed files with 220 additions and 15 deletions
+5 -1
View File
@@ -31,7 +31,7 @@ export function toFixedRounded(num: number, precision: number): number {
return Number((Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision)).toFixed(precision))
}
export function toLocalDate(value: string) {
export function toLocalDate(value: string | Date) {
const date = new Date(value);
return date.toLocaleDateString('de-DE', { day: '2-digit', month: 'short', year: 'numeric' });
// return date.toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' });
@@ -71,6 +71,10 @@ export function bgColorForString(input: string): string {
return randomColors[charCodeSum % randomColors.length];
}
export function clearSelection() {
window.getSelection()?.removeAllRanges();
};
const promise = () => new Promise((resolve) => setTimeout(resolve, 2000))
export function testToast() {
let delay = 150