LF-5408 Add issue date to DFC payload - #4284
Merged
Merged
Conversation
node-pg returns Postgres `date` columns as Date objects set to local midnight, and setSemanticPropertyLiteral stringifies its value with toString(). issue_date was therefore emitted as "Wed Jul 01 2026 00:00:00 GMT+0000 (Coordinated Universal Time)" instead of the agreed "2026-07-01". formatDateOnly reads the local date components. toISOString() would report the previous day whenever the API server runs east of UTC. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
issue_date is a Postgres `date` column but was absent from the json replacer list, so it reached clients as "2024-01-01T00:00:00.000Z". A client west of UTC converting that instant to local time reads the previous day, and the certification form showed the issue date one day early. valid_until was already in the list. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
kathyavini
commented
Aug 1, 2026
| 'effective_date', | ||
| 'germination_date', | ||
| 'harvest_date', | ||
| 'issue_date', |
Collaborator
Author
There was a problem hiding this comment.
This change is not related to the DFC payload at all, but for the value returned to the frontend, so that it matches valid_until (already included).
This fixes a bug where the issue date is seen to shift backwards by one day compared to what you input, on a UTC+ farm. I did not notice until now because I so rarely make UTC+ farms!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
After confirmation (see Jira ticket) that a date on Certification is consistent with the DFC Ontology and just missing from the connector, this adds the date manually to the certification part of the DFC payload.
'YYYY-MM-DD' has been confirmed the correct format... which then we had to generate from our db format which is a datetime. Oops, I think I would have requested a datetime from OFN + DFC if I had tested the flow first 😝
Jira link: https://lite-farm.atlassian.net/browse/LF-5408
Type of change
How Has This Been Tested?
The DFC Adapter test was initially updated, but since that just passes through the string unchanged, the more important test was hitting the /enterprises endpoint locally to observe the date format:
and adding to the API test, which actually uses the database value.
Checklist:
pnpm i18nto help with this)