ebs.InvariantDate

JSON object that stores a date in a culture-invariant format.

Syntax

Copy
class ebs.InvariantDate(inputDate)
 
Parameter Description
inputDate Date object or string representing a date. Eg:
  • InvariantDate(2019, 10, 20)
  • InvariantDate("2019-10-20")
  • InvariantDate("2019-10-20T13:45:43") (the time information is ignored)

Return Value

Returns a JSON object that contains the date in culture-invariant format (in the form: {"invariantDate":"2020-01-23"}).

Properties

Property Returned Type Description
day number The day component of the date, expressed as a value between 1 and 31.
dayOfWeek number The day of the week, expressed as a value between 1 (Monday) and 7 (Sunday).
dayOfYear number The day of the year, expressed as a value between 1 and 366.
month number The month component of the date, expressed as a value between 1 and 12.
today InvariantDate The current date.
year number The year component of the date.
weekOfYear FintechOS 21.2.0 and later number The week of the year, expressed as a value between 1 and 53

Methods

Method Returned Type Description
addDays(number) InvariantDate Adds the specified number of days to the value of the instance and returns the instance. Negative values subtract the specified number of days (dates prior to 0001-01-01 are not supported).
addMonths(number) InvariantDate Adds the specified number of months to the value of the instance and returns the instance. Negative values subtract the specified number of months (dates prior to 0001-01-01 are not supported).
NOTE  
The day component of the date is "rounded down". For instance, adding one month to 2020-03-31 will return 2020-04-30.
addYears(number) InvariantDate Adds the specified number of years to the value of the instance and returns the instance. Negative values subtract the specified number of years (dates prior to 0001-01-01 are not supported).
NOTE  
The day component of the date is "rounded down". For instance, adding one year to 2020-02-29 will return 2021-02-28.
toString() string Returns a string representation of the instance's value in "yyyy-mm-dd" format.
getEndOfMonth(date: InvariantDate) FintechOS 21.2.0 and later InvariantDate Returns an invariant date matching the last day from the month of the input date.
dateDiff(datePart: string, startDate: InvariantDate, endDate: InvariantDate) FintechOS 21.2.0 and later number Returns the number of days, weeks, months, quarters, or years between the startDate and endDate, depending on the dateDiff parameter. Supported values for the dateDiff parameter are: "Day", "Week", "Month", "Quarter", and "Year".

Examples