le

Returns whether the receiver is earlier than or equal to another month. Comparison uses the month index only.

import { Month } from "@teakit/month";

Month.from("2025-01").le("2025-02"); // true
Month.from("2025-01").le("2025-01"); // true
Month.from("2025-02").le("2025-01"); // false

Month.le("2025-01", "2025-01"); // true

API Reference

Signatures

month.le(other: MonthValue): boolean;
Month.le(left: MonthValue, right: MonthValue): boolean;

Parameters

ParameterTypeRequiredNotes
otherMonthValueInstance onlyMonth compared against the receiver.
leftMonthValueStatic onlyLeft-hand month.
rightMonthValueStatic onlyRight-hand month.

Returns

Returns true when the left month is earlier than or equal to the right; otherwise false.

Throws

  • Throws when an input value is not a valid month.

Agent Contract

FieldValue
Kindinstance method and static helper
Canonical namele
AliasesNone
Mutates receiverNo
Returnsboolean
Orderingchronological
Related methodslt, ge, cmp

Agent Notes

  • Use comparison methods instead of relational operators on Month values.
  • Use lt when equality should be excluded.