Namespace: datetime

bcdui.util. datetime

Functions related to processing and formatting of (XML-) dates.

Methods

staticbcdui.util.datetime.formatDate(date){String}

The date in the XML date format (e.g. "2010-07-23")
Name Type Description
date Date
Returns:
Type Description
String

staticbcdui.util.datetime.formatDateTime(date){String}

The date in the XML datetime format (e.g. "2010-07-23T00:00:00")
Name Type Description
date Date
Returns:
Type Description
String

staticbcdui.util.datetime.getISOWeekNumber(date){integer}

Calculates the ISO week number the date belongs to. Derived from Klaus Tondering's Calendar document.
Name Type Description
date Date | string date for which to determine the CW
Returns:
Type Description
integer cw

staticbcdui.util.datetime.getISOWeekYear(date){integer}

Calculates The year of the ISO week the date lies within. This can be different from the year of the date, especially when the year has 53 ISO weeks.
Name Type Description
date Date | string date for which to determine the CW
Returns:
Type Description
integer cwYr

staticbcdui.util.datetime.getShortMonthName(month){String}

The month name as abbreviated string (e.g. "Jul")
Name Type Description
month int
Returns:
Type Description
String .

staticbcdui.util.datetime.increasePeriod(value, startDate, endDate)

Shifts the given period by the given value The value is assumed to have the same period type (qu, mo, dy) as startDate and endDate
Name Type Description
value integer An integer of how many periods the input is to be shifted. Negative values are allowed.
startDate Date
endDate Date

staticbcdui.util.datetime.isMonthRange(startDate, endDate){boolean}

Tests if the given date range covers exactly one or more months.
Name Type Description
startDate Date | string First day of the date range
endDate Date | string Last day of the date range
Returns:
Type Description
boolean

staticbcdui.util.datetime.isQuarterRange(startDate, endDate){boolean}

Tests if the date range corresponds to exactly to one quarter (Jan - Mar, Apr - Jun, Jul - Sep or Oct - Dec of the same year)
Name Type Description
startDate Date | string First day of the date range
endDate Date | string Last day of the date range
Returns:
Type Description
boolean

staticbcdui.util.datetime.isValidDate(date){boolean}

Checks if date passed is valid date
Name Type Description
date String The date string to be parsed.
Returns:
Type Description
boolean Whether the parsed "date" argument is valid date string.

staticbcdui.util.datetime.isWeekRange(startDate, endDate){boolean}

Tests if the given date range covers exactly one or more calendar weeks.
Name Type Description
startDate Date | string First day of the date range
endDate Date | string Last day of the date range
Returns:
Type Description
boolean

staticbcdui.util.datetime.isYearRange(startDate, endDate){boolean}

Tests if the specified date range exactly covers exactly one or more years
Name Type Description
startDate Date | string First day of the date range
endDate Date | string Last day of the date range
Returns:
Type Description
boolean

staticbcdui.util.datetime.parseDate(date){Date}

Parses a date if the argument is a string or returns the date otherwise. The date can be in XML date or timestamp format.
Name Type Description
date Date | string The date object to be parsed.
Returns:
Type Description
Date The parsed date or the "date" argument if it is already a date object.

staticbcdui.util.datetime.prettyPrintDateRange(startDate, endDate){String}

Pretty prints a date range
Name Type Description
startDate Date | string First day of the date range
endDate Date | string Last day of the date range
Returns:
Type Description
String A string describing the date range (e.g. "Jul 2010" or "CW 30, 2010").