Skip to content

Conversation

@chrimesdev
Copy link
Member

Description

fix: fix the date formatting for date strings for DoB

Context

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@chrimesdev chrimesdev requested a review from Copilot September 11, 2025 13:25
Copy link
Contributor

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 date formatting for Date of Birth (DoB) values by simplifying the formatCompactDate function and standardizing date formats across the codebase. The changes ensure consistent handling of date strings in ISO format (YYYY-MM-DD) rather than compact format (YYYYMMDD).

  • Simplified formatCompactDate function to use native Date constructor instead of manual string parsing
  • Updated mock data to use ISO date format (YYYY-MM-DD) for consistency
  • Updated test cases to reflect the new expected input format

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
utils.ts Simplified formatCompactDate function and minor quote consistency fix
utils.test.ts Updated test input format from compact to ISO date format
mockExceptions.json Converted all DateOfBirth values from YYYYMMDD to YYYY-MM-DD format
Comments suppressed due to low confidence (1)

application/CohortManager/src/Web/app/lib/utils.test.ts:37

  • The test coverage for formatCompactDate is insufficient. Consider adding tests for edge cases such as invalid date strings, empty strings, and malformed date formats to ensure the function handles them gracefully.
describe("formatCompactDate", () => {
  it("should format the date as 26 February 1993", () => {
    const input = "1993-02-26";
    const expectedOutput = "26 February 1993";
    expect(formatCompactDate(input)).toBe(expectedOutput);
  });
});

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link

github-actions bot commented Sep 11, 2025

Unit Test Results

✔️ Tests 823 / 823 - passed in 65.9s
📝 Coverage 57.74%
📏 4491 / 7647 lines covered 🌿 1071 / 1986 branches covered
🔍 click here for more details

✏️ updated for commit 332f693

Copy link
Contributor

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@sonarqubecloud
Copy link

@chrimesdev chrimesdev added this pull request to the merge queue Sep 11, 2025
Merged via the queue into main with commit a6e809c Sep 11, 2025
67 checks passed
@chrimesdev chrimesdev deleted the fix/date-formatting branch September 11, 2025 14:06
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.

2 participants