fix: validate invalid blog post dates - #280
sameerchore wants to merge 5 commits into
Conversation
… file in blog post date
… and to not show the wrong date to blog by its own
Signed-off-by: Sameer Chore <sameerchore5@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Warning Review limit reachedNext included review available in 47 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to Blog dates and post order can differ between local and CI builds for quoted timestamps without a timezone. The change is mergeable with that bounded risk understood or corrected. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 18bd59e9-472c-4ce6-8c08-c722f3431188
📒 Files selected for processing (2)
scripts/data/blog.mjstests/data/blog.test.mjs
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.
|
Rather than this, can't we just edit the blog posts to have the right dates? |
yes true I thought on this ,that dev should write valid blog dates. I just added validation as fallback bcoz invalid dates and incorrect format previously allowed the build to succeed with incorrect data.Now It provides an early, clear error, as I pasted img of before after in decription , If this not still needed I'll work to other area by closing this... |
|
This just seems awfully complex for something that (should be, if it were to exist) fairly simple |
|
Understood. , if I find any other optimal way I will continue with this ...otherwise avoids adding unnecessary build logic and will close pr , thanks for the feedback. |
Summary
Fix blog date validation during documentation builds.
JavaScript can normalize invalid dates such as
2026-02-30(30 days in feb is incorrect date) into a different valid date instead of rejecting them. This could allow incorrect blog metadata to pass through the build.This change validates the calendar date and time components before generating blog data. Invalid values now fail with an error that includes the affected file and date value.
What kind of change does this PR introduce?
Bug fix and test improvement.
Did you add tests for your changes?
Yes. Tests cover:
2026-02-30Does this PR introduce a breaking change?
No. Valid blog dates continue to work as before. Dates that were previously accepted and normalized incorrectly are now rejected during the build.
Before
After
Invalid dates are rejected with a clear validation error identifying the file and value.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
No documentation required.
Use of AI
AI was used during investigation and implementation review. The changes and test results were reviewed locally.
Summary by CodeRabbit