Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Date Time Laravel Package

brick/date-time

Immutable, ISO-8601–focused date/time API for PHP 8.2+ built on top of native DateTime, adding missing types like LocalDate, LocalTime, YearMonth, and MonthDay. Inspired by Java’s JSR-310, well-tested, production-ready, Composer installable.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Immutable Date/Time Logic: Enables building robust, thread-safe systems where date/time operations (e.g., scheduling, time-based validations) are critical. Ideal for financial systems, healthcare, or any domain requiring strict temporal consistency.
  • Time Zone & DST Handling: Supports complex time zone logic (e.g., ZonedDateTime, TimeZoneRegion) for global applications (e.g., SaaS platforms, logistics, or multi-region event coordination).
  • Testing & Mocking: The Clock system (e.g., FixedClock, travelTo()) simplifies time-based testing, reducing flakiness in CI/CD pipelines for features like:
    • Subscription billing cycles.
    • Time-sensitive notifications (e.g., reminders, expirations).
  • ISO 8601 Compliance: Standardizes date/time formats across microservices, APIs, or integrations (e.g., with JavaScript/TypeScript frontends or Java backends).
  • Build vs. Buy: Replaces custom date/time utilities or ad-hoc Carbon/DateTime logic, reducing tech debt and improving maintainability.
  • Roadmap Priorities:
    • Phase 1: Replace legacy DateTime logic in core services (e.g., user account expiration, event scheduling).
    • Phase 2: Adopt in new features requiring precise temporal logic (e.g., calendar invites, time-tracking tools).
    • Phase 3: Integrate with Doctrine for ORM consistency (via brick/date-time-doctrine).

When to Consider This Package

  • Avoid if:
    • Your app uses PHP < 8.2 (minimum requirement).
    • You need minimal dependencies (this adds ~1MB to vendor space).
    • Your team lacks PHP 8.2+ expertise (e.g., enums, strict typing).
    • You’re already satisfied with Carbon or DateTime for your use cases (e.g., simple date formatting).
  • Look elsewhere if:
    • You need high-performance parsing (e.g., parsing millions of logs); consider spatie/array-to-object or league/iso8601 for lightweight needs.
    • Your stack is non-PHP (e.g., Node.js, Python); use native libraries or cross-language standards like ISO 8601.
    • You require database-specific optimizations (e.g., PostgreSQL’s TIMESTAMPTZ); use ORM-specific tools.
  • Consider if:
    • You’re building a time-sensitive system (e.g., trading, healthcare, or compliance).
    • Your team values immutability and type safety over brevity.
    • You need advanced features like:
      • LocalDateRange for date-based intervals (e.g., "Q1 2025").
      • Duration/Period for precise time arithmetic (e.g., "3 years, 2 months").
      • Stopwatch for benchmarking or performance tracking.

How to Pitch It (Stakeholders)

For Executives:

"This package modernizes our date/time handling with a battle-tested, ISO-compliant library that reduces bugs in time-sensitive features. For example:

  • Saves 20+ hours/year by eliminating flaky time-based tests (via FixedClock).
  • Future-proofs global features (e.g., multi-region support) with robust DST/time zone handling.
  • Lowers risk by adopting a widely used (362 stars) library with MIT licensing. It’s a low-risk upgrade—we can pilot it in non-critical services first (e.g., analytics) before rolling out to core systems."

For Engineering:

"This replaces inconsistent DateTime/Carbon usage with a type-safe, immutable API that:

  • Prevents bugs: Immutable objects eliminate side effects (e.g., LocalDate::now() won’t mutate state).
  • Simplifies testing: travelTo() and freeze() make time-based tests deterministic (no more sleep(1) hacks).
  • Aligns with modern PHP: Uses enums (DayOfWeek::MONDAY), strict typing, and PHP 8.2+ features.
  • Integrates easily: Works with Doctrine (brick/date-time-doctrine) and has zero dependents (no hidden risks). Migration effort: ~2–4 weeks for core services, with incremental adoption via feature flags."*

For Developers:

"Key wins:

  • No more strtotime hacks: Parse ISO 8601 strings directly (e.g., LocalDate::parse('2025-03-15')).
  • Cleaner APIs: Methods like nextDayOfWeek() or getQuarter() replace verbose DateTime arithmetic.
  • Test-friendly: Freeze time in tests with DefaultClock::freeze()—no more DateTime::modify() spaghetti. Example swap:
// Before (Carbon)
$nextWeek = Carbon::now()->addWeek()->startOfDay();

// After (Brick)
$nextWeek = LocalDate::now()->nextOrSameDayOfWeek(DayOfWeek::MONDAY);
```"
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky