Skip to main content

LongCount

Defined in: lc/long-count.ts:37

Long Count cycle.

The Long Count is a mixed-radix numeral system used by the ancient Maya to track days elapsed since a creation-era base date. This implementation uses the standard epoch per scholarly literature [R1, R2]:

Epoch (Maya Day Number (MDN) = 0): 13.0.0.0.0 4 Ajaw 8 Kumk'u

This date represents the completion of the 13th bak'tun in Maya cosmology and serves as the anchor for all Long Count calculations and correlation with Western calendars. MDN is analogous to Julian Day Number, but for the Maya calendar system.

Units (mixed-radix system):

  • 1 k'in = 1 day
  • 1 winal = 20 k'in
  • 1 tun = 18 winal = 360 days
  • 1 k'atun = 20 tun = 7,200 days
  • 1 bak'tun = 20 k'atun = 144,000 days

See​

  • Reingold, Dershowitz, & Clamen (1993) [R1]
  • Martin & Skidmore (2012) [R2]

Extends​

Constructors​

Constructor​

new LongCount(...cycles): LongCount

Defined in: lc/long-count.ts:219

Parameters​

cycles​

...(number | Wildcard)[]

Components in the long count (eg, K'in, Winal, Bak'tun, etc)

Returns​

LongCount

Overrides​

DistanceNumber.constructor

Properties​

comment​

comment: Comment

Defined in: comment-wrapper.ts:11

Attached comment.

Inherited from​

DistanceNumber.comment


datePattern​

datePattern: RegExp

Defined in: lc/distance-number.ts:12

Inherited from​

DistanceNumber.datePattern


parts​

parts: (number | Wildcard)[]

Defined in: lc/distance-number.ts:11

Inherited from​

DistanceNumber.parts


sign​

sign: number

Defined in: lc/distance-number.ts:13

Inherited from​

DistanceNumber.sign

Accessors​

bakTun​

Get Signature​

get bakTun(): number | Wildcard

Defined in: lc/distance-number.ts:262

Return the bak'tun component of the fullDate

Returns​

number | Wildcard

Set Signature​

set bakTun(newBakTun): void

Defined in: lc/distance-number.ts:254

Set the bak'tun component of the fullDate

Parameters​
newBakTun​

number | Wildcard

Returns​

void

Inherited from​

DistanceNumber.bakTun


gregorian​

Get Signature​

get gregorian(): GregorianCalendarDate

Defined in: lc/long-count.ts:261

Return a Gregorian representation of this long count date, offset by the correlation constant.

Returns​

GregorianCalendarDate


isNegative​

Get Signature​

get isNegative(): boolean

Defined in: lc/distance-number.ts:60

Return true if the Long Count is operating as a negative Distance Number.

Returns​

boolean

Set Signature​

set isNegative(newNegative): void

Defined in: lc/distance-number.ts:76

Set this Long Count as being a negative Distance Number

Parameters​
newNegative​

boolean

Returns​

void

Inherited from​

DistanceNumber.isNegative


isPositive​

Get Signature​

get isPositive(): boolean

Defined in: lc/distance-number.ts:52

Return true if the Long Count is positive.

Returns​

boolean

Set Signature​

set isPositive(newPositive): void

Defined in: lc/distance-number.ts:68

Set this Long Count as being a Long Count or a positive Distance Number

Parameters​
newPositive​

boolean

Returns​

void

Inherited from​

DistanceNumber.isPositive


julian​

Get Signature​

get julian(): JulianCalendarDate

Defined in: lc/long-count.ts:269

Return a Julian representation of this long count date, offset by the correlation constant.

Returns​

JulianCalendarDate


julianDay​

Get Signature​

get julianDay(): number

Defined in: lc/long-count.ts:253

Return a representation of this Long Count in Julian Days.

Returns​

number


kalabtun​

Get Signature​

get kalabtun(): number | Wildcard

Defined in: lc/distance-number.ts:292

Return the kalabtun component of the fullDate

Returns​

number | Wildcard

Set Signature​

set kalabtun(newBakTun): void

Defined in: lc/distance-number.ts:284

Set the kalabtun component of the fullDate

Parameters​
newBakTun​

number | Wildcard

Returns​

void

Inherited from​

DistanceNumber.kalabtun


kAtun​

Get Signature​

get kAtun(): number | Wildcard

Defined in: lc/distance-number.ts:247

Return the k'atun component of the fullDate

Returns​

number | Wildcard

Set Signature​

set kAtun(newKAtun): void

Defined in: lc/distance-number.ts:239

Set the k'atun component of the fullDate

Parameters​
newKAtun​

number | Wildcard

Returns​

void

Inherited from​

DistanceNumber.kAtun


kIn​

Get Signature​

get kIn(): number | Wildcard

Defined in: lc/distance-number.ts:202

Return the k'in component of the fullDate

Returns​

number | Wildcard

Set Signature​

set kIn(newKIn): void

Defined in: lc/distance-number.ts:194

Set the k'in component of the fullDate

Parameters​
newKIn​

number | Wildcard

Returns​

void

Inherited from​

DistanceNumber.kIn


kinchiltun​

Get Signature​

get kinchiltun(): number | Wildcard

Defined in: lc/distance-number.ts:307

Return the kinchiltun component of the fullDate

Returns​

number | Wildcard

Set Signature​

set kinchiltun(newBakTun): void

Defined in: lc/distance-number.ts:299

Set the kinchiltun component of the fullDate

Parameters​
newBakTun​

number | Wildcard

Returns​

void

Inherited from​

DistanceNumber.kinchiltun


lordOfNight​

Get Signature​

get lordOfNight(): LordOfTheNight

Defined in: lc/long-count.ts:285

Returns​

LordOfTheNight


piktun​

Get Signature​

get piktun(): number | Wildcard

Defined in: lc/distance-number.ts:277

Return the piktun component of the fullDate

Returns​

number | Wildcard

Set Signature​

set piktun(newBakTun): void

Defined in: lc/distance-number.ts:269

Set the piktun component of the fullDate

Parameters​
newBakTun​

number | Wildcard

Returns​

void

Inherited from​

DistanceNumber.piktun


sigParts​

Get Signature​

get sigParts(): (number | Wildcard)[]

Defined in: lc/distance-number.ts:120

Only digits in the LC with significant digits

Returns​

(number | Wildcard)[]

Inherited from​

DistanceNumber.sigParts


tun​

Get Signature​

get tun(): number | Wildcard

Defined in: lc/distance-number.ts:232

Return the tun component of the fullDate

Returns​

number | Wildcard

Set Signature​

set tun(newTun): void

Defined in: lc/distance-number.ts:224

Set the tun component of the fullDate

Parameters​
newTun​

number | Wildcard

Returns​

void

Inherited from​

DistanceNumber.tun


winal​

Get Signature​

get winal(): number | Wildcard

Defined in: lc/distance-number.ts:217

Return the winal component of the fullDate

Returns​

number | Wildcard

Set Signature​

set winal(newWinal): void

Defined in: lc/distance-number.ts:209

Set the winal component of the fullDate

Parameters​
newWinal​

number | Wildcard

Returns​

void

Inherited from​

DistanceNumber.winal

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​

DistanceNumber.appendComment


asDistanceNumber()​

asDistanceNumber(): DistanceNumber

Defined in: lc/long-count.ts:340

Return this Long Count as a Distance Number

Returns​

DistanceNumber


buildCalendarRound()​

buildCalendarRound(): CalendarRound

Defined in: lc/long-count.ts:295

Returns​

CalendarRound


buildFullDate()​

buildFullDate(): FullDate

Defined in: lc/long-count.ts:305

Returns​

FullDate

FullDate


clone()​

clone(): LongCount

Defined in: lc/long-count.ts:277

Create a copy object of this long count fullDate

Returns​

LongCount

Overrides​

DistanceNumber.clone


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​

DistanceNumber.commentIsEqual


equal()​

equal(other): boolean

Defined in: lc/long-count.ts:351

Compare two Long Count dates for equality. Unlike DistanceNumber.equal(), this compares all parts, handling trailing zeros correctly. This ensures dates with k'in=0 are compared correctly (e.g., 0.0.0.0.0 vs 0.2.12.13.0).

Parameters​

other​

IPart

Returns​

boolean

Overrides​

DistanceNumber.equal


equalWithComment()​

equalWithComment(otherCommentWrapper): boolean

Defined in: comment-wrapper.ts:67

Check equality including the associated comment.

Parameters​

otherCommentWrapper​

IPart

Returns​

boolean

Inherited from​

DistanceNumber.equalWithComment


exactlyEqual()​

exactlyEqual(other): boolean

Defined in: lc/distance-number.ts:107

Given two long count dates, check if they are exactly equal

Parameters​

other​

DistanceNumber

Returns​

boolean

Inherited from​

DistanceNumber.exactlyEqual


getDateSections()​

getDateSections(index): number | Wildcard

Defined in: lc/distance-number.ts:145

Get specific column in Long Count fullDate

Parameters​

index​

number

Returns​

number | Wildcard

Inherited from​

DistanceNumber.getDateSections


getPosition()​

getPosition(): number

Defined in: lc/distance-number.ts:332

Count the number of days since 0.0.0.0.0 for this LC.

Returns​

number

Inherited from​

DistanceNumber.getPosition


gt()​

gt(newLongCount): boolean

Defined in: lc/distance-number.ts:187

Compare is this LC is less than the supplied LC.

Parameters​

newLongCount​

DistanceNumber

Returns​

boolean

Inherited from​

DistanceNumber.gt


isPartial()​

isPartial(): boolean

Defined in: lc/distance-number.ts:324

Returns true if any of the positions in the Long Count have been assigned a Wildcard object.

Returns​

boolean

Inherited from​

DistanceNumber.isPartial


isValid()​

isValid(): boolean

Defined in: lc/distance-number.ts:315

Ensure the fullDate has only numbers and wildcards separated by points.

Returns​

boolean

Inherited from​

DistanceNumber.isValid


lt()​

lt(newLongCount): boolean

Defined in: lc/distance-number.ts:178

Compare if this LC is greater than the supplied LC.

Parameters​

newLongCount​

DistanceNumber

Returns​

boolean

Inherited from​

DistanceNumber.lt


map()​

map(fn): any[]

Defined in: lc/distance-number.ts:169

Pass the map down to the parts

Parameters​

fn​

(lcPart, lcPartIndex) => any

Returns​

any[]

Inherited from​

DistanceNumber.map


minus()​

minus(newLc): LongcountSubtraction

Defined in: lc/long-count.ts:329

Return the difference between this Long Count and the supplied

Parameters​

newLc​

LongCount

Returns​

LongcountSubtraction

Overrides​

DistanceNumber.minus


normalise()​

normalise(): DistanceNumber

Defined in: lc/distance-number.ts:399

Make sure the elements of the Long Count do not exceed their valid ranges. Converts the Long Count to total days, then decomposes back to normalized form with proper carry/borrow per the mixed-radix system [R1, R2]:

  • k'in ∈ [0,19]
  • winal ∈ [0,17] (18 winal = 1 tun)
  • tun ∈ [0,19]
  • k'atun ∈ [0,19]
  • bak'tun and higher are unbounded

Returns​

DistanceNumber

Inherited from​

DistanceNumber.normalise


plus()​

plus(newLc): LongcountAddition

Defined in: lc/long-count.ts:317

Return the sum of this Long Count and the supplied

Parameters​

newLc​

LongCount

Returns​

LongcountAddition

Overrides​

DistanceNumber.plus


resetComment()​

resetComment(): this

Defined in: comment-wrapper.ts:20

Reset the current comment back to an empty comment.

Returns​

this

Inherited from​

DistanceNumber.resetComment


setComment()​

setComment(comment): this

Defined in: comment-wrapper.ts:28

Replace the current comment.

Parameters​

comment​

string | Comment

Returns​

this

Inherited from​

DistanceNumber.setComment


setCorrelationConstant()​

setCorrelationConstant(newConstant): LongCount

Defined in: lc/long-count.ts:244

Chainable method to set the correlation constant

Parameters​

newConstant​

CorrelationConstant

Returns​

LongCount


setDateSections()​

setDateSections(index, newValue): LongCount

Defined in: lc/distance-number.ts:159

Set specific column in Long Count fullDate

Parameters​

index​

number

newValue​

number | Wildcard

Returns​

LongCount

Inherited from​

DistanceNumber.setDateSections


toString()​

toString(): string

Defined in: lc/distance-number.ts:454

Convert the LongCount to a string and pad the sections of the fullDate

Returns​

string

Inherited from​

DistanceNumber.toString


fromDistanceNumber()​

static fromDistanceNumber(dn): LongCount

Defined in: lc/long-count.ts:39

Parameters​

dn​

DistanceNumber

Returns​

LongCount


fromGregorian()​

static fromGregorian(gregorian, correlation?): LongCount

Defined in: lc/long-count.ts:74

Create a Long Count from a Gregorian date.

Accepts JavaScript Date objects or ISO 8601 date strings and converts them to the corresponding Maya Long Count date using the specified correlation constant. The default correlation (584283, original GMT) is used unless specified otherwise.

Important: This method uses the proleptic Gregorian calendar for all dates, including historical dates before the Gregorian calendar was adopted in 1582. JavaScript Date objects always use the proleptic Gregorian calendar. Only the date portion is used; any time components are ignored.

Supports ISO 8601 date format: "YYYY-MM-DD" (e.g., "2012-12-21")

Parameters​

gregorian​

string | Date

JavaScript Date object or ISO 8601 date string

correlation?​

CorrelationConstant = ...

Correlation constant for alignment (default: 584283 GMT)

Returns​

LongCount

A Long Count instance representing the same date

Throws​

If the date is invalid or results in a negative Maya Day Number

Example​

// From JavaScript Date object
const date = new Date('2012-12-21');
const lc1 = LongCount.fromGregorian(date);
console.log(lc1.toString()); // "13. 0. 0. 0. 0"

// From ISO 8601 date string
const lc2 = LongCount.fromGregorian('2012-12-21');
console.log(lc2.toString()); // "13. 0. 0. 0. 0"

fromJulianDay()​

static fromJulianDay(julianDay, correlation?): LongCount

Defined in: lc/long-count.ts:132

Create a Long Count from a Julian Day Number.

Converts a Julian Day Number to the corresponding Maya Long Count date using the specified correlation constant. The Maya Day Number (MDN) is calculated as: MDN = JDN - correlation_constant.

Parameters​

julianDay​

number

The Julian Day Number to convert

correlation?​

CorrelationConstant = ...

Correlation constant for alignment (default: 584283 GMT)

Returns​

LongCount

A Long Count instance representing the same date

Throws​

If the resulting Maya Day Number is negative

Example​

const lc = LongCount.fromJulianDay(2456283);
console.log(lc.toString()); // "13. 0. 0. 0. 0"

fromMayanDayNumber()​

static fromMayanDayNumber(mayanDayNumber, correlation?): LongCount

Defined in: lc/long-count.ts:162

Create a Long Count from a Maya Day Number (days since 0.0.0.0.0).

Converts a Maya Day Number (total days elapsed since the creation date) into the corresponding Long Count notation using the mixed-radix system:

  • k'in (base 20)
  • winal (base 18)
  • tun, k'atun, bak'tun (base 20)

Parameters​

mayanDayNumber​

number

Days elapsed since 0.0.0.0.0 (must be non-negative)

correlation?​

CorrelationConstant

Optional correlation constant to set on the result

Returns​

LongCount

A Long Count instance representing the date

Throws​

If mayanDayNumber is negative

Example​

const lc = LongCount.fromMayanDayNumber(1872000); // 13.0.0.0.0
console.log(lc.toString()); // "13. 0. 0. 0. 0"