Blogs Engineering

Showing Stored Dates in IOTA SDK Edit Forms

Englischer Artikel. IOTA SDK's date and datetime-local fields rendered empty on edit pages. The merged fix formats stored values the way HTML inputs expect.

Goiota-uz/iota-sdktemplHTML formsERP

A Go templating fix for date inputs that came up blank.

Kurze Antwort

In IOTA SDK, date fields on edit pages didn't show the value stored in the database. The date field only rendered its default, and the datetime-local field passed a raw time.Time as an attribute value. The fix uses the stored value when present and formats it in the layout HTML expects. It was merged as PR #1031 and closed issue #340.

The problem

Issue #340, filed by a maintainer, reported that date fields rendered by the CRUD builder on edit pages "are missing the value that is set in DB", and that the same issue appeared on other pages.

The fix

const dateTimeLocalLayout = "2006-01-02T15:04"
...
if val := mapping.Or(f.value, f.defaultVal); !val.IsZero() {
    attrs["value"] = val.Format(time.DateOnly)
}
...
if val := mapping.Or(f.value, f.defaultVal); !val.IsZero() {
    attrs["value"] = val.Format(dateTimeLocalLayout)
}

Zero values now omit the value attribute entirely, and stored values take precedence over defaults.

By the numbers

  • Repository: iota-uz/iota-sdk, 476 stars (Nov 3, 2026), Go, Apache-2.0
  • Files changed: 2 (1 source file, 1 new test file)
  • Lines: +120 / -4
  • Commits: 2
  • Opened: Aug 21, 2026. Merged: Sep 6, 2026. Time to merge: 15 days, 19 hours
  • Review: merged by a maintainer after automated review feedback was addressed

How the review went

An automated reviewer asked for two things: table-driven tests, per the repo's guidelines, and cases covering stored values through WithValue, including precedence over defaults. The follow-up commit addressed both, and the final 112-line test file covers defaults, stored values, precedence, formatting and empty fields. The maintainer who filed the issue merged the PR. The public review comments recorded in the supplied research are automated; this is not evidence of a separate human review.

FAQ

Where can I read more?

See the pull request and the original issue.

Das Ziel

HTML date inputs are strict about format. A fix that encodes the exact layout once, with tests around it, keeps edit pages honest about what is stored.

Loop ausführen

Verwandle Produktionssignale in geprüfte Fixes.

Starte eine kostenlose Testversion und sieh, wie Prilog reale Incidents mit Pull Requests auf Code-Ebene verbindet.