Skip to main content

Haab

Defined in: cr/haab.ts:35

Describes a Haab fullDate with a position and a month

Examples

let day = new Haab(8, "Kumk'u");
let day = new Haab(8, new HaabMonth("Kumk'u"));

Extends

Implements

Constructors

Constructor

new Haab(coeff, month): Haab

Defined in: cr/haab.ts:51

Constructor

Parameters

coeff

ICoefficient

The position in the Haab month for this date

month

Wildcard | HaabMonth

Returns

Haab

Overrides

CommentWrapper.constructor

Properties

coeff

coeff: ICoefficient

Defined in: cr/haab.ts:42


comment

comment: Comment

Defined in: comment-wrapper.ts:11

Attached comment.

Inherited from

CommentWrapper.comment


month

month: Wildcard | HaabMonth

Defined in: cr/haab.ts:43

Accessors

name

Get Signature

get name(): string

Defined in: cr/haab.ts:151

Return a string representation of the Haab month name

Returns

string

Methods

appendComment()

appendComment(comment): this

Defined in: comment-wrapper.ts:42

Append additional text to the current comment.

Parameters

comment

string | Comment

Returns

this

Inherited from

CommentWrapper.appendComment


commentIsEqual()

commentIsEqual(otherCommentWrapper): boolean

Defined in: comment-wrapper.ts:60

Compare this wrapper's comment against another wrapper.

Parameters

otherCommentWrapper

CommentWrapper

Returns

boolean

Inherited from

CommentWrapper.commentIsEqual


equal()

equal(other): boolean

Defined in: cr/haab.ts:227

Compare this object with another for equality.

Parameters

other

IPart

Returns

boolean

Implementation of

IPart.equal


equalWithComment()

equalWithComment(otherCommentWrapper): boolean

Defined in: comment-wrapper.ts:67

Check equality including the associated comment.

Parameters

otherCommentWrapper

IPart

Returns

boolean

Inherited from

CommentWrapper.equalWithComment


match()

match(otherHaab): boolean

Defined in: cr/haab.ts:137

Ensure this Haab object has a matching configuration as another Haab object. Takes wildcards into account.

Parameters

otherHaab

Haab

Returns

boolean


next()

next(): Haab

Defined in: cr/haab.ts:129

Return the next day in the Haab cycle

Returns

Haab


resetComment()

resetComment(): this

Defined in: comment-wrapper.ts:20

Reset the current comment back to an empty comment.

Returns

this

Inherited from

CommentWrapper.resetComment


setComment()

setComment(comment): this

Defined in: comment-wrapper.ts:28

Replace the current comment.

Parameters

comment

string | Comment

Returns

this

Inherited from

CommentWrapper.setComment


shift()

shift(numDays): Haab

Defined in: cr/haab.ts:166

Move this date through the Haab cycle using direct formula per [R1] §3.3.

Formula:

  • H = (currentH + days) mod 365, where currentH is the day-of-year index
  • monthIndex = ⌊H / 20⌋ + 1
  • day = H mod 20

Parameters

numDays

number

Number of days to shift (positive for forward, negative for backward)

Returns

Haab


toString()

toString(): string

Defined in: cr/haab.ts:223

Render the Haab fullDate as a string

Returns

string


validate()

validate(): boolean

Defined in: cr/haab.ts:75

Ensure the Haab's coefficients are within range and the month is defined

Returns

boolean


fromDayNumber()

static fromDayNumber(dayNumber): Haab

Defined in: cr/haab.ts:108

Create a Haab' date from a day number (days since epoch) using direct formula per [R1] §3.3.

Formula:

  • H = (d + haabEpochDay + 20·(haabEpochMonth − 1)) mod 365 (with proper negative handling)
  • monthIndex = ⌊H / 20⌋ + 1
  • day = H mod 20

Parameters

dayNumber

number

Days since Long Count epoch (Maya Day Number)

Returns

Haab