Skip to content

cleanup: migrate inline Math.floor(Date.now()/1000) to nowUnix() helper #121

@ignromanov

Description

@ignromanov

Context

PR #115 introduced src/shared/lib/date-time/index.ts with nowUnix() and daysFromNowUnix(n) helpers to centralize Unix timestamp creation. However, the migration was incomplete — several production files still use the raw Math.floor(Date.now() / 1000) pattern.

Locations to migrate

Production code (must fix):

  • src/features/rpc-proxy/lib/mock.ts — lines 117, 230, 304, 323
  • src/widgets/landing/constants/demo-invoices.ts — line 31

Test utilities (optional):

  • src/shared/lib/test-utils/invoice-generator.ts — line 140 (test utils intentionally capturing raw Date.now() is acceptable; migrate only if it improves consistency)

Proposal

Replace all production occurrences with nowUnix() imported from @/shared/lib/date-time. No behavior change — purely mechanical substitution.

Acceptance Criteria

  • Math.floor(Date.now() / 1000) replaced with nowUnix() in mock.ts (4 occurrences) and demo-invoices.ts (1 occurrence)
  • test-utils/invoice-generator.ts — migrated or left with a comment explaining the intentional raw usage
  • pnpm type-check:build && pnpm lint pass
  • All tests pass

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    advisor:kaiAssigned to Kai (CTO)p2Nice-to-haverefactorCode refactoring without feature changestech-debtTechnical debt items

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions