Datumsspalten auf Date-Typ umgestellt und Normalisierungsmigration
Modelle: startdatum (Projekt), datum und wiedervorlage_datum (CallLog) von String(20) auf Date umgestellt. columns2dict serialisiert diese nun über isoformat() als yyyy-MM-dd. Die String-Normalisierung in columns2dict wurde entfernt, da sie nicht mehr benötigt wird. Migration V01.08: Normalisiert bestehende String-Datumswerte (z.B. '2026-08-3') auf ISO-Format yyyy-MM-dd mittels printf/substr, da SQLite's date() einstellige Komponenten nicht erkennt. Leere Strings werden zu NULL. V01.07 ist Platzhalter für die fehlgeschlagene V01.06. Client: toDateInputValue normalisiert ebenfalls String-Datumswerte als Fallback für Route-Params (Neuanlage). Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
1 parent
93827dde0f
commit
461953a7e9
3 files changed
+108
-6
No files matched your search
@@ -118,10 +118,20 @@ export const Textarea:m.Component<iTextarea> = {
|
||||
}
|
||||
|
||||
export function toDateInputValue(date: Date|string): string {
|
||||
console.log(date, typeof(date), (date instanceof Date))
|
||||
let result: string = null
|
||||
if (typeof date === "string") {
|
||||
result = date
|
||||
// String-Datumswerte (aus der DB) auf das vom HTML-Date-Input
|
||||
// geforderte Format yyyy-MM-dd normalisieren (führende Nullen).
|
||||
if (date === "") {
|
||||
result = ""
|
||||
} else {
|
||||
const parts = date.split("-")
|
||||
if (parts.length === 3) {
|
||||
result = [parts[0], parts[1].padStart(2, "0"), parts[2].padStart(2, "0")].join("-")
|
||||
} else {
|
||||
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("-")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user