Skip to content

Fix hardcoded publication date default in webapp#1709

Open
jcschaff wants to merge 1 commit into
masterfrom
fix-publication-pubdate-default
Open

Fix hardcoded publication date default in webapp#1709
jcschaff wants to merge 1 commit into
masterfrom
fix-publication-pubdate-default

Conversation

@jcschaff

Copy link
Copy Markdown
Member

Summary

New publications were defaulting vc_publication.pubdate to a hardcoded literal 2023-12-28, and users couldn't change it.

Two webapp causes:

  • publication-new.component.ts onNew() seeded the default Publication with date: "2023-12-28" (placeholder scaffold data).
  • The Date <input> in publication-edit.component.html was commented out, so the placeholder propagated, unedited, all the way to the database.

The backend was innocent — PublicationResource.add()PublicationService.savePublication()DbDriver faithfully stored whatever date the webapp sent. No 2023-12-28 literal exists in the Java/DB code.

Changes

  • publication-new.component.ts: default new publications' date to today (new Date().toISOString().slice(0, 10)yyyy-MM-dd) instead of the literal.
  • publication-edit.component.html: uncomment the Date input so users can set/correct the date.

Compatibility

yyyy-MM-dd round-trips through the OpenAPI Publication.date string and the backend @JsonFormat("yyyy-MM-dd"). No OpenAPI client regeneration or backend change required.

Notes / follow-ups (not in this PR)

  • onNew() still contains other placeholder defaults (title: "title", authors: ["string"], doi: "doi", …) — out of scope here, but worth cleaning up to empty values.
  • toISOString() is UTC, so the default date can read as "tomorrow" for users several hours behind UTC creating a publication late at night. It's only a default and now editable; can switch to a local-date computation if preferred.

🤖 Generated with Claude Code

New publications defaulted their date to the literal "2023-12-28" in the
publication-new form's onNew() template, and the date input on the edit form
was commented out, so every publication created/edited via the webapp wrote
2023-12-28 to vc_publication.pubdate.

- Default new publications' date to today (yyyy-MM-dd) instead of the literal.
- Uncomment the Date input in the edit form so users can set/correct the date.

Format (yyyy-MM-dd) round-trips through the OpenAPI Publication.date string and
the backend @jsonformat("yyyy-MM-dd"); no client regen or backend change needed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant