refactor(api): replace TimeFrame middleware with time schema utility#714
Draft
luis-herasme wants to merge 4 commits intomainfrom
Draft
refactor(api): replace TimeFrame middleware with time schema utility#714luis-herasme wants to merge 4 commits intomainfrom
luis-herasme wants to merge 4 commits intomainfrom
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
5 Skipped Deployments
|
Contributor
📦 Next.js Bundle Analysis for @blobscan/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
Description
Simplifies the timeframe input. Previously, we were using a middleware probably because of the need to transform the input to a date, now we are using the
zodschema directly to transform the input to a date.Previously, the input value
Allwas permitted but not processed correctly (check theparseInt, it was creatingNaN).The old logic returned a date range where the end date was always set to the end of yesterday and the start date was calculated as (end date minus the number of days). This approach caused issues particularly when handling single-day ranges, requiring special case handling. Now, instead of returning a range with a fixed end date, we simply return a timestamp calculated as the current time minus the number of days in milliseconds. This makes the logic simpler and more consistent across all cases.