Fix ISO Date Format Validation in getAuthorLocalHour Function - #8754
Conversation
|
This pull request enhances the getAuthorLocalHour function by validating ISO 8601 date formats, which is crucial for maintaining reliable date processing. This approach aligns with previous decisions made regarding date validation in the utils/dateHelpers.ts file, particularly the handling of invalid dates to prevent errors. Thank you for your contribution, and please let me know if you need any further assistance! |
75029c3 to
1dd284e
Compare
|
Someone is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
📦 Next.js Bundle Size Report (Gzipped Sizes)✨ No significant bundle size changes detected. 📊 Summary of Totals
|
Aamod007
left a comment
There was a problem hiding this comment.
Nice catch! Adding a regex check for the \YYYY-MM-DDT\ ISO 8601 format in \utils/dateHelpers.ts\ before attempting substring extraction makes the \getAuthorLocalHour\ function significantly more robust. Falling back to the \Date\ object parser when the string doesn't match ensures we don't return garbage hours for unexpected formats. The tests added look great too. Approved!
|
🎉 Congratulations @tmdeveloper007! Your PR has been successfully merged. 🚀 Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.
Keep building! 💻✨ |
Description
Added ISO 8601 date format validation to
getAuthorLocalHourinutils/dateHelpers.ts. Checks for theYYYY-MM-DDTprefix before substring extraction, falling back tonew Date()parsing for non-ISO formats.Pillar
Checklist
CONTRIBUTING.mdfile.Note
Please assign this PR to the
tmdeveloper007account.Closes #8746