YouTrack InCloud 2017.2 Help

Date-time

Workflow module Date-time from package @jetbrains/youtrack-scripting-api

Date and time related operations

Module functions

 

format

static format(timestamp, format, timeZoneId)

Creates string representation of a timestamp.

See also:

  • parse for timezone id description
  • parse for format string description.

Parameters:

NameTypeDescription
timestamp number timestamp to be formatted into a string.
format string format of the output.
timeZoneId string id of a timezone.

Returns:

TypeDescription
string string representation of the timestamp.

 

parse

static parse(dateTimeString, formats, timeZoneId)

Parses string representation of a date. Use this method instead of Date.parse()(see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse for explanation).

Parameters:

NameTypeDescription
dateTimeString string string representation of a date.
formats string, Array.<string> a format that the dateTimeString matches or an array of formats.In case an array is provided, the formats are tried sequentially unless the dateTimeString is successfully parsed.If not specified, a current user's format is used. If there's no logged in user (e.g. when calling inside an on schedule rule),system default format is used.
timeZoneId string id of a timezone that the dateTimeString is in. Only effective in case a format thatmatches the string does not provide any timestamp information. In case neither format(s) nor this parameterprovide any timezone information, a time zone of a current user will be taken. If there's no logged in user(e.g. when calling inside an on schedule rule), system default format is used.See JodaTime for a list of timezone ids.

Returns:

TypeDescription
number timestamp representation of the provided date.

 

toPeriod

static toPeriod(period)

Creates a period representation of an argument.

See also:

issue.fields.Estimation = dateTime.toPeriod(3 * 3600 * 1000); // 3h in ms issue.fields.Estimation = dateTime.toPeriod('3h'); // short form issue.fields.Estimation = dateTime.toPeriod('2w4d3h15m'); // full form

Parameters:

NameTypeDescription
period number, string duration in milliseconds as either a number or a string.

Returns:

TypeDescription
Period period representation of an argument

 

Last modified: 9 August 2017