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

Vo Date Time Laravel Package

awd-studio/vo-date-time

Immutable PHP 8.3+ date-time value object. Create from strings, compare (equal/greater/less/between), and return new instances for changes like nextDay(), copy(), or modified() with DateTimePeriod offsets (days, minutes, weeks).

View on GitHub
Deep Wiki
Context7

Date-time value-object

Provides a useful wrapper for dates as an value-object implementation.

Instances are immutable.

Requirements:

  • php >= 8.3

Installation:

composer install awd-studio/vo-date-time

Usage:

<?php

use Awd\ValueObject\DateTime;
use Awd\ValueObject\DateTimePeriod;

// Comparing dates:
$dateTime1 = DateTime::fromString('2024-12-28');
$dateTime2 = DateTime::fromString('2024-12-30');
$dateTime3 = DateTime::fromString('2024-12-01');

$dateTime1->isEqual($dateTime2); // false
$dateTime1->isGreaterThan($dateTime2); // false
$dateTime1->isLessThanOrEquals($dateTime2); // true
$dateTime1->isBetween($dateTime3, $dateTime2) // true

// Modifying
$nextDayDt = $dateTime1->nextDay(); // Returns new instance for next day.
$copyDt = $dateTime1->copy(); // Returns a copy with same date.
$modDt = $dateTime1->modified(new DateTimePeriod(days: 1)); // Tomorrow.
$modDt = $dateTime1->modified(new DateTimePeriod(minutes: -5)); // 5 mins ago.
$modDt = $dateTime1->modified(new DateTimePeriod(weeks: 2, days: -2)); // In 12 days.
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.
calliostro/spotify-bundle
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle