Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(api): replace TimeFrame middleware with time schema utility #714

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

luis-herasme
Copy link
Member

Checklist

  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

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 zod schema directly to transform the input to a date.

Previously, the input value All was permitted but not processed correctly (check the parseInt, it was creating NaN).

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.

Copy link

changeset-bot bot commented Feb 10, 2025

⚠️ No Changeset found

Latest commit: fa4406c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Feb 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blobscan-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 10, 2025 5:11am
5 Skipped Deployments
Name Status Preview Comments Updated (UTC)
blobscan-docs ⬜️ Ignored (Inspect) Visit Preview Feb 10, 2025 5:11am
blobscan-gnosis ⬜️ Ignored (Inspect) Visit Preview Feb 10, 2025 5:11am
blobscan-holesky ⬜️ Ignored (Inspect) Visit Preview Feb 10, 2025 5:11am
blobscan-mainnet ⬜️ Ignored (Inspect) Visit Preview Feb 10, 2025 5:11am
blobscan-sepolia ⬜️ Ignored (Inspect) Visit Preview Feb 10, 2025 5:11am

Copy link
Contributor

github-actions bot commented Feb 10, 2025

📦 Next.js Bundle Analysis for @blobscan/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

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.

1 participant