eq

Returns whether the receiver is the same month as another value. Day anchors are ignored — comparison uses the month index only.

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

Month.from("2025-01").eq("2025-01"); // true
Month.from("2025-01").eq("2025-02"); // false
Month.from("2025-01-31").eq("2025-01"); // true — anchor ignored

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

API Reference

Signatures

month.eq(other: MonthValue): boolean;
Month.eq(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 months are equal; otherwise false.

Throws

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

Agent Contract

FieldValue
Kindinstance method and static helper
Canonical nameeq
AliasesNone
Mutates receiverNo
Returnsboolean
Orderingchronological
Related methodsne, cmp

Agent Notes

  • Use comparison methods instead of relational operators on Month values.
  • Day anchors never affect equality; only the year-month is compared.