Constructor
new ParsedYear(year, originalString)
Create a new ParsedYear instance.
Parameters:
| Name | Type | Description |
|---|---|---|
year |
number | string | null | The year value. Can be a numeric year, special strings ("beginning", "onwards"), or null for unbounded ranges. |
originalString |
string | null | The original string representation to preserve user formatting. If not provided, will be derived from year. |
- Source:
Methods
equals(otherParsedYear) → {boolean}
Compare this ParsedYear with another for equality.
For numeric years, compares the numeric values.
For special strings and null, compares string representations.
Parameters:
| Name | Type | Description |
|---|---|---|
otherParsedYear |
ParsedYear | The other ParsedYear to compare against. |
- Source:
Returns:
True if the years are considered equal.
- Type
- boolean
getNumericYear() → {number|null}
Get the numeric year value.
- Source:
Returns:
The numeric year if hasFiniteNumericYear() is true,
null otherwise.
- Type
- number | null
getYearStr() → {string}
Get the string representation of the year for display or code generation.
- Source:
Returns:
The original string representation if available,
otherwise a string representation of the year value.
- Type
- string
hasFiniteNumericYear() → {boolean}
Check if this ParsedYear represents a finite numeric year.
- Source:
Returns:
True if the year is a finite number, false for
special strings ("beginning", "onwards") or null values.
- Type
- boolean