Typanpassung für toDateInputValue: Unterstützung für Datums- und String-Parameter hinzugefügt

This commit is contained in:
gg committed 2026-08-30 15:27:55 +02:00
1 parent e0a87f48db
commit ada80d0938
1 file changed
+4 -2
+4 -2
View File
@@ -117,10 +117,12 @@ export const Textarea:m.Component<iTextarea> = {
} }
} }
export function toDateInputValue(date: Date): string { export function toDateInputValue(date: Date|string): string {
console.log(date, typeof(date), (date instanceof Date)) console.log(date, typeof(date), (date instanceof Date))
let result: string = null let result: string = null
if (date instanceof Date && date != null) { if (typeof date === "string") {
result = date
} else if (date instanceof Date && date != null) {
result = [date.getFullYear(), (date.getMonth() + 1).toString().padStart(2, "0"), date.getDate().toString().padStart(2, "0")].join("-") result = [date.getFullYear(), (date.getMonth() + 1).toString().padStart(2, "0"), date.getDate().toString().padStart(2, "0")].join("-")
} }
return result return result