Skip to content

perf: avoid creating Date objects when parsing timestamps#2256

Merged
ghostdevv merged 1 commit intonpmx-dev:mainfrom
trivikr:avoid-date-obj-creation
Mar 24, 2026
Merged

perf: avoid creating Date objects when parsing timestamps#2256
ghostdevv merged 1 commit intonpmx-dev:mainfrom
trivikr:avoid-date-obj-creation

Conversation

@trivikr
Copy link
Contributor

@trivikr trivikr commented Mar 24, 2026

🔗 Linked issue

N/A

🧭 Context

Uses Date.parse(...) instead of new Date(...).getTime() when converting date strings to timestamps.

📚 Description

Uses Date.parse(...) instead of new Date(...).getTime() when converting date strings to timestamps. This avoids creating unnecessary Date objects while keeping the behavior the same for string-based parsing paths used in sorting, TID generation, and related tests.

@vercel
Copy link

vercel bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Mar 24, 2026 5:28am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 24, 2026 5:28am
npmx-lunaria Ignored Ignored Mar 24, 2026 5:28am

Request Review

@codecov
Copy link

codecov bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
shared/utils/atproto.ts 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 29ba3973-349a-40bf-a9c8-40dd92205064

📥 Commits

Reviewing files that changed from the base of the PR and between 1fd2d53 and c50e007.

📒 Files selected for processing (9)
  • app/composables/npm/usePackage.ts
  • app/composables/useStructuredFilters.ts
  • app/pages/search.vue
  • modules/blog.ts
  • scripts/generate-fixtures.ts
  • server/api/atproto/bluesky-comments.get.ts
  • shared/utils/atproto.ts
  • test/nuxt/composables/use-package-comparison.spec.ts
  • test/unit/app/utils/download-anomalies.spec.ts

📝 Walkthrough

Walkthrough

This pull request systematically replaces new Date(dateString).getTime() with Date.parse(dateString) across eight files for date-to-timestamp conversion. The changes are applied to sorting comparators and date computations in version management, blog post sorting, search functionality, Bluesky thread replies, and TID generation utilities. The sorting logic, control flow, and downstream calculations remain unchanged; only the date parsing mechanism is updated.

Possibly related PRs

  • fix: standard.site fixes #1901: Modifies the same TID-related utilities in shared/utils/atproto.ts (generateBlogTID and npmxPublicationRkey) that are updated in this PR.

Suggested reviewers

  • danielroe
  • graphieros
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description clearly explains the change: replacing new Date(...).getTime() with Date.parse(...) for timestamp conversion to improve performance by avoiding unnecessary Date object creation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ghostdevv ghostdevv added this pull request to the merge queue Mar 24, 2026
Merged via the queue into npmx-dev:main with commit 327f156 Mar 24, 2026
20 checks passed
@trivikr trivikr deleted the avoid-date-obj-creation branch March 24, 2026 14:17
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.

2 participants