Skip to content

Missing ChronosTime differences and modifiers methods #522

@GustavoPeixoto

Description

@GustavoPeixoto

With version 3 ChronosTime lost all differences and modifiers methods like:

public function modify(string $modifier): static;
public function diff(ChonosTime $target, bool $absolute = false): DateInterval;
public function addHours(int $value): static;
public function subHours(int $value): static;
public function addMinutes(int $value): static;
public function subMinutes(int $value): static;
public function addSeconds(int $value): static;
public function subSeconds(int $value): static;

public function closest(ChonosTime $first, ChonosTime $second, ChonosTime ...$others): static;
public function farthest(ChonosTime $first, ChonosTime $second, ChonosTime ...$others): static;
public function min(?ChonosTime $other = null): static;
public function max(?ChonosTime $other = null): static;
public function average(?ChonosTime $other = null): static;
public function wasWithinLast(string|int $timeInterval): bool;
public function isWithinNext(string|int $timeInterval): bool;

public function diffFiltered(DateInterval $interval, callable $callback, ?ChonosTime $other = null, bool $absolute = true, int $options = 0): int;
public function diffInHoursFiltered(callable $callback, ?ChonosTime $other = null, bool $absolute = true, int $options = 0): int;
public function diffInHours(?ChonosTime $other = null, bool $absolute = true): int;
public function diffInMinutes(?ChonosTime $other = null, bool $absolute = true): int;
public function diffInSeconds(?ChonosTime $other = null, bool $absolute = true): int;
public function secondsSinceMidnight(): int;
public function diffForHumans(?ChonosTime $other = null, bool $absolute = false): string;

Furthermore, in README.md, the "Time-only Values" section is inconsistent, once it describes unexisting methods, like:

$later = $time->addHours(2)->addMinutes(15);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions