Typanpassung für toDateInputValue: Unterstützung für Datums- und String-Parameter hinzugefügt
This commit is contained in:
1 parent
e0a87f48db
commit
ada80d0938
1 file changed
+4
-2
@@ -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))
|
||||
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("-")
|
||||
}
|
||||
return result
|
||||
|
||||
Reference in new issue
Block a user