Skip to content

Conversation

@larsdecker
Copy link
Owner

Summary

  • format FinTS DATE values with a four-digit year using the yyyyMMdd pattern
  • add unit tests to verify the DATE output matches the FinTS DATE datatype requirements

Testing

  • yarn test test-format

Codex Task

Copilot AI review requested due to automatic review settings December 27, 2025 02:44
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 15 to 19
const date = new Date(Date.UTC(12, 5, 7, 12, 0, 0));

const formatted = Format.date(date);

expect(formatted).toBe("00120607");

Choose a reason for hiding this comment

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

P1 Badge Sub-1000-year test constructs 1912 date

The new “pads years below 1000” test never hits a sub-1000 year: JavaScript’s Date.UTC treats years 0–99 as offsets from 1900, so new Date(Date.UTC(12, 5, 7, …)) produces 1912-06-07. Format.date will therefore emit 19120607, making the assertion for 00120607 fail and leaving the intended padding behavior untested. Build the date with setUTCFullYear or a string literal so the test covers a true <1000 year value.

Useful? React with 👍 / 👎.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug in the FinTS date formatting by correcting the date format pattern from "yyy" (three-digit year) to "yyyy" (four-digit year) to comply with the FinTS DATE datatype specification, which requires an eight-digit yyyyMMdd format.

Key Changes:

  • Corrected the date format pattern in Format.date() from "yyyMMdd" to "yyyyMMdd"
  • Added comprehensive unit tests to verify the DATE output format

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/fints/src/format.ts Fixed the date format pattern from "yyyMMdd" to "yyyyMMdd" to ensure four-digit year formatting
packages/fints/src/tests/test-format.ts Added new test file with two test cases: one verifying the standard eight-digit format and another testing edge case of years below 1000 being properly zero-padded

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@larsdecker
Copy link
Owner Author

@copilot Tests are now failing. Can you please fix these.

Copy link

Copilot AI commented Dec 27, 2025

@larsdecker I've opened a new pull request, #29, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits December 27, 2025 02:56
Co-authored-by: larsdecker <1968186+larsdecker@users.noreply.github.com>
Fix date constructor in year padding test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants