Methods
date->isBefore()
Check whether the current date occurs chronologically before another specified date.
The isBefore method evaluates whether the current NepaliDate instance occurs earlier in time than another provided date. It takes into account both date and time components down to millisecond accuracy.
Import
use NepaliDateLibrary\NepaliDate;Signature
public function isBefore(NepaliDate $date): bool;Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
$date | NepaliDate | Yes | Target date to compare against. |
Return Value
- Type:
bool - Description: Returns
trueif current date is chronologically earlier than$date.
Example
use NepaliDateLibrary\NepaliDate;
$d1 = new NepaliDate('2081-01-01');
$d2 = new NepaliDate('2081-01-15');
var_dump($d1->isBefore($d2)); // true
var_dump($d2->isBefore($d1)); // falseRelated
date->isAfter(): Check if later in time.date->isEqual(): Check calendar date equality.
Advertisement
date->endOfYear()
Return a new NepaliDate instance set to the final day of the Bikram Sambat year on the last day of Chaitra.
date->isAfter()
Check whether the current date occurs chronologically after another specified date.