Skip to content

LF-5408 Add issue date to DFC payload - #4284

Merged
SayakaOno merged 5 commits into
integrationfrom
LF-5408-add-issue-date-to-dfc-payload
Aug 4, 2026
Merged

LF-5408 Add issue date to DFC payload#4284
SayakaOno merged 5 commits into
integrationfrom
LF-5408-add-issue-date-to-dfc-payload

Conversation

@kathyavini

@kathyavini kathyavini commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Passes test case
  • UI components visually reviewed on desktop view
  • UI components visually reviewed on mobile view
  • Other (please explain)

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:

http://localhost:5001/dfc/enterprises/

and adding to the API test, which actually uses the database value.

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The precommit and linting ran successfully
  • I have added or updated language tags for text that's part of the UI
  • I have ordered translation keys alphabetically (optional: run pnpm i18n to help with this)
  • I have added the GNU General Public License to all new files

@kathyavini kathyavini self-assigned this Jul 29, 2026
@kathyavini kathyavini added the enhancement New feature or request label Jul 29, 2026
@kathyavini
kathyavini marked this pull request as ready for review July 31, 2026 16:50
@kathyavini
kathyavini requested review from a team as code owners July 31, 2026 16:50
@kathyavini
kathyavini requested review from SayakaOno and removed request for a team July 31, 2026 16:50
kathyavini and others added 2 commits July 31, 2026 18:34
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>
'effective_date',
'germination_date',
'harvest_date',
'issue_date',

@kathyavini kathyavini Aug 1, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@SayakaOno SayakaOno left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@SayakaOno
SayakaOno added this pull request to the merge queue Aug 4, 2026
Merged via the queue into integration with commit 169fd4a Aug 4, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants