Skip to content

fix: corrected date suffix logic for 11th, 12th, and 13th#877

Open
vibhutomer wants to merge 1 commit intoCCExtractor:mainfrom
vibhutomer:fix-date-suffix
Open

fix: corrected date suffix logic for 11th, 12th, and 13th#877
vibhutomer wants to merge 1 commit intoCCExtractor:mainfrom
vibhutomer:fix-date-suffix

Conversation

@vibhutomer
Copy link

@vibhutomer vibhutomer commented Mar 11, 2026

Description

This PR fixes a date formatting bug where the 11th, 12th, and 13th days of the month were incorrectly displayed with the wrong suffixes (e.g., "11st", "12nd", "13rd").

Proposed Changes

  • Updated the getFormattedDate() function in lib/app/utils/utils.dart.
  • Added an else block to the existing if (day >= 11 && day <= 13) condition. This prevents the subsequent switch (day % 10) statement from executing and incorrectly overwriting the valid 'th' suffix.

Fixes #875

Screenshots

Before (Bug: "12nd"):

Screenshot (889)

After (Fixed: "12th"):

Screenshot (890)

Checklist

  • Tests have been added or updated to cover the changes
  • Documentation has been updated to reflect the changes
  • Code follows the established coding style guidelines
  • All tests are passing

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.

Bug: Incorrect date suffix (11st, 12nd, 13rd) in getFormattedDate

1 participant