Skip to main content

Tzolkin

Defined in: cr/tzolkin.ts:34

Describes a fullDate in the 260-day cycle with a position and a day

Examples

let day = new Tzolkin(4, "Ajaw");
let day = new Tzolkin(4, new TzolkinDay("Ajaw"));

Extends

Implements

Constructors

Constructor

new Tzolkin(newCoeff, newDay): Tzolkin

Defined in: cr/tzolkin.ts:62

Constructor

Parameters

newCoeff

ICoefficient

The position in the 260-day cycle

newDay

Wildcard | TzolkinDay

Returns

Tzolkin

Overrides

CommentWrapper.constructor

Properties

coeff

coeff: ICoefficient

Defined in: cr/tzolkin.ts:42


comment

comment: Comment

Defined in: comment-wrapper.ts:11

Attached comment.

Inherited from

CommentWrapper.comment


day

day: Wildcard | TzolkinDay

Defined in: cr/tzolkin.ts:41

Accessors

name

Get Signature

get name(): string | Wildcard

Defined in: cr/tzolkin.ts:222

Return a string representation of the 260-day cycle name

Returns

string | Wildcard

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/tzolkin.ts:192

Ensure this Tzolkin object has the same configuration as another Tzolkin object. Does not take wildcards into account.

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(newTzolkin): boolean

Defined in: cr/tzolkin.ts:205

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

Parameters

newTzolkin

Tzolkin

Returns

boolean


next()

next(): Tzolkin

Defined in: cr/tzolkin.ts:107

Return the next day in the 260-day cycle

Returns

Tzolkin


nextCalculator()

nextCalculator(): Tzolkin

Defined in: cr/tzolkin.ts:166

Returns

Tzolkin


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(newIncremental): Tzolkin

Defined in: cr/tzolkin.ts:144

Shift this Tzolk'in date by a number of days using direct formula per [R1]. Positive values shift forward in the 260-day cycle; negative values shift backward.

Uses the adjusted modulus formula from spec §4.3-4.4:

  • adjmod(x, n) = ((x - 1) mod n) + 1
  • number = adjmod(currentNumber + days, 13)
  • nameIndex = adjmod(currentNameIndex + days, 20)

Parameters

newIncremental

number

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

Returns

Tzolkin


toString()

toString(): string

Defined in: cr/tzolkin.ts:233

Render the 260-day cycle fullDate as a string

Returns

string


validate()

validate(): boolean

Defined in: cr/tzolkin.ts:115

Ensure the Tzolkin's coefficients are within range and the day is defined

Returns

boolean


fromDayNumber()

static fromDayNumber(dayNumber): Tzolkin

Defined in: cr/tzolkin.ts:93

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

Formula:

  • adjmod(x, n) = ((x − 1) mod n) + 1 (with proper negative handling)
  • number = adjmod(d + tzEpochNumber, 13)
  • nameIndex = adjmod(d + tzEpochName, 20)

Parameters

dayNumber

number

Days since epoch (MDN), can be negative for dates before epoch

Returns

Tzolkin