@drewsonne/maya-dates / Exports / DistanceNumber
Minimal interface used for equality comparison across calendar components.
↳ DistanceNumber
↳↳ LongCount
• new DistanceNumber(...cycles
)
Name | Type | Description |
---|---|---|
...cycles |
(number | Wildcard )[] |
Components in the long count (eg, K’in, Winal, Bak’tun, etc) |
• comment: Comment
Attached comment.
• datePattern: RegExp
• parts: (number
| Wildcard
)[]
• sign: number
• get
bakTun(): number
| Wildcard
Return the bak’tun component of the fullDate
number
| Wildcard
• set
bakTun(newBakTun
): void
Set the bak’tun component of the fullDate
Name | Type |
---|---|
newBakTun |
number | Wildcard |
void
• get
isNegative(): boolean
Return true if the Long Count is operating as a negative Distance Number.
boolean
• set
isNegative(newNegative
): void
Set this Long Count as being a negative Distance Number
Name | Type |
---|---|
newNegative |
boolean |
void
• get
isPositive(): boolean
Return true if the Long Count is positive.
boolean
• set
isPositive(newPositive
): void
Set this Long Count as being a Long Count or a positive Distance Number
Name | Type |
---|---|
newPositive |
boolean |
void
• get
kAtun(): number
| Wildcard
Return the k’atun component of the fullDate
number
| Wildcard
• set
kAtun(newKAtun
): void
Set the k’atun component of the fullDate
Name | Type |
---|---|
newKAtun |
number | Wildcard |
void
• get
kIn(): number
| Wildcard
Return the k’in component of the fullDate
number
| Wildcard
• set
kIn(newKIn
): void
Set the k’in component of the fullDate
Name | Type |
---|---|
newKIn |
number | Wildcard |
void
• get
kalabtun(): number
| Wildcard
Return the kalabtun component of the fullDate
number
| Wildcard
• set
kalabtun(newBakTun
): void
Set the kalabtun component of the fullDate
Name | Type |
---|---|
newBakTun |
number | Wildcard |
void
• get
kinchiltun(): number
| Wildcard
Return the kinchiltun component of the fullDate
number
| Wildcard
• set
kinchiltun(newBakTun
): void
Set the kinchiltun component of the fullDate
Name | Type |
---|---|
newBakTun |
number | Wildcard |
void
• get
piktun(): number
| Wildcard
Return the piktun component of the fullDate
number
| Wildcard
• set
piktun(newBakTun
): void
Set the piktun component of the fullDate
Name | Type |
---|---|
newBakTun |
number | Wildcard |
void
• get
sigParts(): (number
| Wildcard
)[]
Only digits in the LC with significant digits
(number
| Wildcard
)[]
• get
tun(): number
| Wildcard
Return the tun component of the fullDate
number
| Wildcard
• set
tun(newTun
): void
Set the tun component of the fullDate
Name | Type |
---|---|
newTun |
number | Wildcard |
void
• get
winal(): number
| Wildcard
Return the winal component of the fullDate
number
| Wildcard
• set
winal(newWinal
): void
Set the winal component of the fullDate
Name | Type |
---|---|
newWinal |
number | Wildcard |
void
▸ appendComment(comment
): any
Append additional text to the current comment.
Name | Type |
---|---|
comment |
string | Comment |
any
▸ clone(): DistanceNumber
Create a copy object of this long count fullDate
▸ commentIsEqual(otherCommentWrapper
): boolean
Compare this wrapper’s comment against another wrapper.
Name | Type |
---|---|
otherCommentWrapper |
CommentWrapper |
boolean
▸ equal(other
): boolean
Given two long count dates, check if they are equal
Name | Type |
---|---|
other |
IPart |
boolean
▸ equalWithComment(otherCommentWrapper
): boolean
Check equality including the associated comment.
Name | Type |
---|---|
otherCommentWrapper |
IPart |
boolean
CommentWrapper.equalWithComment
▸ exactlyEqual(other
): boolean
Given two long count dates, check if they are exactly equal
Name | Type |
---|---|
other |
DistanceNumber |
boolean
▸ getDateSections(index
): number
| Wildcard
Get specific column in Long Count fullDate
Name | Type |
---|---|
index |
number |
number
| Wildcard
▸ getPosition(): number
Count the number of days since 0.0.0.0.0 for this LC.
number
▸ gt(newLongCount
): boolean
Compare is this LC is less than the supplied LC.
Name | Type |
---|---|
newLongCount |
DistanceNumber |
boolean
▸ isPartial(): boolean
Returns true if any of the positions in the Long Count have been assigned a {Wildcard} object.
boolean
▸ isValid(): boolean
Ensure the fullDate has only numbers and wildcards separated by points.
boolean
▸ lt(newLongCount
): boolean
Compare if this LC is greater than the supplied LC.
Name | Type |
---|---|
newLongCount |
DistanceNumber |
boolean
▸ map(fn
): any
[]
Pass the map down to the parts
Name | Type |
---|---|
fn |
(lcPart : number | Wildcard , lcPartIndex : number ) => any |
any
[]
▸ minus(newLc
): LongcountSubtraction
Return the difference between this Long Count and the supplied
Name | Type |
---|---|
newLc |
DistanceNumber |
▸ normalise(): DistanceNumber
Make sure the elements of the Long Count do not exceed
▸ plus(newLc
): LongcountAddition
Return the sum of this Long Count and the supplied
Name | Type |
---|---|
newLc |
DistanceNumber |
▸ setComment(comment
): any
Replace the current comment.
Name | Type |
---|---|
comment |
string | Comment |
any
▸ setDateSections(index
, newValue
): DistanceNumber
Set specific column in Long Count fullDate
Name | Type |
---|---|
index |
number |
newValue |
number | Wildcard |
▸ toString(): string
Convert the LongCount to a string and pad the sections of the fullDate
string