Nepali DateNepali DateBikram Sambat Date Engine
Methods

date.is_before()

Check whether the current date occurs chronologically before another specified date.

The is_before 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

from nepali_date_library import NepaliDate

Signature

def is_before(self, date: NepaliDate) -> bool:

Parameters

ParameterTypeRequiredDescription
dateNepaliDateYesTarget date to compare against.

Return Value

  • Type: bool
  • Description: Returns True if self is chronologically earlier than date.

Example

from nepali_date_library import NepaliDate

d1 = NepaliDate("2081-01-01")
d2 = NepaliDate("2081-01-15")

print(d1.is_before(d2)) # True
print(d2.is_before(d1)) # False

Advertisement

On this page