UNPKG

@quasar/quasar-ui-qcalendar

Version:

QCalendar - Day/Month/Week Calendars, Popups, Date Pickers, Schedules, Agendas, Planners and Tasks for your Vue Apps

1,709 lines 50.1 kB
{ "meta": { "docsUrl": "https://qcalendar.netlify.app/developing/timestamp" }, "methods": { "today": { "addedIn": "v2.2.1", "desc": "Returns today's date in YYYY-MM-DD format", "params": null, "returns": { "type": "String", "desc": "Returns today's date in YYYY-MM-DD format", "__exemption": [ "examples" ] } }, "getStartOfWeek": { "desc": "Returns the start of the week based on the passed in arguments", "params": { "timestamp": { "extends": "timestamp", "required": true }, "weekdays": { "type": "Array", "tsType": "NumberArray", "desc": "The normal weekdays array looks like this `[0,1,2,3,4,5,6]` where 0=Sunday, 1=Monday, etc. A week that starts on Monday, would look like this: `[1,2,3,4,5,6,0]` and a 5-day workweek would look like this: `[1,2,3,4,5]`", "required": true, "examples": [ "[0,1,2,3,4,5,6]", "[1,2,3,4,5,6,0]", "[1,2,3,4,5]" ] }, "today": { "extends": "timestamp", "desc": "A timestamp object that represents 'today' or a specified point in time. If passed in, then the relative information to the start-of-week timestamp object will be updated" } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object representing the start of the week", "__exemption": [ "examples" ] } }, "getEndOfWeek": { "desc": "Returns the end of the week based on the passed in arguments", "params": { "timestamp": { "extends": "timestamp", "required": true }, "weekdays": { "type": "Array", "tsType": "NumberArray", "desc": "The normal weekdays array looks like this `[0,1,2,3,4,5,6]` where 0=Sunday, 1=Monday, etc. A week that starts on Monday, would look like this: `[1,2,3,4,5,6,0]` and a 5-day workweek would look like this: `[1,2,3,4,5]`", "required": true, "examples": [ "[0,1,2,3,4,5,6]", "[1,2,3,4,5,6,0]", "[1,2,3,4,5]" ] }, "today": { "extends": "timestamp", "desc": "A timestamp object that represent 'today' or a specified point in time. If passed in, then the relative information to the end-of-week timestamp object will be updated" } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object representing the end of the week", "__exemption": [ "examples" ] } }, "getStartOfMonth": { "desc": "Returns the start of the month based on the passed in timestamp object", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object representing the start of the month", "__exemption": [ "examples" ] } }, "getEndOfMonth": { "desc": "Returns the end of the month based on the passed in timestamp object", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object representing the end of the month", "__exemption": [ "examples" ] } }, "parseTime": { "desc": "Parses the passed in value and returns the number of minutes since midnight", "params": { "input": { "type": [ "Number", "String", "Object" ], "tsType": "TimeObjectOrNumberOrString", "required": true, "desc": "Value may be a Number (minutes since midnight) or String (hh:mm:ss where seconds are optional) or Object (must have keys **hour** and **minute**)", "examples": [ "600", "'15:30'", "{ hour: 15, minute: 30 }" ] } }, "returns": { "type": "Number", "desc": "The number of minutes since midnight", "__exemption": [ "examples" ] } }, "validateTimestamp": { "desc": "Validates the passed in date/time string (YYYY-MM-DD hh:mm:ss)", "params": { "input": { "type": "String", "required": true, "desc": "A date/time string in the form `YYYY-MM-DD hh:mm:ss` (seconds are optional)", "examples": [ "'2020-10-02 15:00'" ] } }, "returns": { "type": "Boolean", "desc": "True if the passed in date/time string is of correct form" } }, "parsed": { "desc": "Parses a date/time string to a simple timestamp object. For a more complete timestamp, use parseTimestamp", "params": { "input": { "type": "String", "required": true, "desc": "A date/time string in the form `YYYY-MM-DD hh:mm:ss` (seconds are optional)", "examples": [ "'2020-10-02 15:00'" ] } }, "returns": { "type": [ "Object", "null" ], "tsType": "TimestampOrNull", "desc": "A timestamp object based on the passed in argument. Returns 'null' on error", "__exemption": [ "examples" ] } }, "parseTimestamp": { "desc": "Parses a date/time string to the timestamp object. Very similar to the `parsed` method, except also updates timestamp with formatted and relative information", "params": { "input": { "type": "String", "required": true, "desc": "A date/time string in the form `YYYY-MM-DD hh:mm:ss` (seconds are optional)", "examples": [ "'2020-10-02 15:00'" ] }, "now": { "type": "Object", "tsType": "TimestampOrNull", "desc": "[Optional] A Timestamp object. If provided, the returning Timestamp will have formatted and relative information included", "__exemption": [ "examples" ] } }, "returns": { "type": [ "Object", "null" ], "tsType": "TimestampOrNull", "desc": "A timestamp object based on the passed in argument. Returns 'null' on error", "__exemption": [ "examples" ] } }, "parseDate": { "desc": "Parses a JavaScript Date object to the timestamp object", "params": { "input": { "type": "Date", "required": true, "desc": "A JavaScript Date object", "__exemption": [ "examples" ] } }, "returns": { "type": [ "Object", "null" ], "tsType": "TimestampOrNull", "desc": "A formatted timestamp object based on the passed in argument (see updateFormatted)", "__exemption": [ "examples" ] } }, "makeDate": { "addedIn": "v1.3.9", "desc": "Takes a timestamp and returns a JavaScript Date with time set to 00:00", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Date", "desc": "The returned value is a JavaScript Date", "__exemption": [ "examples" ] } }, "makeDateTime": { "addedIn": "v1.3.9", "desc": "Takes a timestamp and returns a JavaScript Date", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Date", "desc": "The returned value is a JavaScript Date", "__exemption": [ "examples" ] } }, "getDayIdentifier": { "desc": "Turns passed in timestamp object to a day identifier", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Number", "desc": "The returned number is in a number representing `YYYYMMdd`", "__exemption": [ "examples" ] } }, "getTimeIdentifier": { "desc": "Turns passed in timestamp object to a time identifier", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Number", "desc": "The returned number is in a number representing `hhmm`", "__exemption": [ "examples" ] } }, "getDayTimeIdentifier": { "desc": "Turns passed in timestamp object to a date/time identifier", "addedIn": "v3.2.0", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Number", "desc": "The returned number is in a number representing `YYYYMMddhhmm`", "__exemption": [ "examples" ] } }, "diffTimestamp": { "desc": "Returns the number of milliseconds between the two days", "params": { "timestamp1": { "extends": "timestamp", "required": true }, "timestamp2": { "extends": "timestamp", "required": true }, "strict": { "type": "Boolean", "desc": "If true, then negative values are not allowed", "required": true, "__exemption": [ "examples" ] } }, "returns": { "type": "Number", "desc": "The number of milliseconds between the two timestamp objects. 0 if **strict** is true and the value would be negative", "__exemption": [ "examples" ] } }, "updateRelative": { "desc": "Updates the relative information in the timestamp object. The relative information includes, compared to the **now** object, `past`, `current` and `future` booleans", "params": { "timestamp": { "extends": "timestamp", "required": true }, "now": { "extends": "timestamp", "required": true, "desc": "A timestamp object representing a **now** time (fixed point in time -- usually **today**)" }, "time": { "type": "Boolean", "desc": "If true, also uses time to adjust the relative information", "default": "false", "__exemption": [ "examples" ] } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object", "__exemption": [ "examples" ] } }, "updateMinutes": { "desc": "Updates the timestamp object with the passed in minutes", "params": { "timestamp": { "extends": "timestamp", "required": true }, "minutes": { "type": "Number", "required": true, "desc": "The number of minutes since midnight", "__exemption": [ "examples" ] }, "now": { "extends": "timestamp", "desc": "A timestamp object, if set, used to adjust the relative information" } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object", "__exemption": [ "examples" ] } }, "updateWeekday": { "desc": "Updates the timestamp object with the weekday information", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object", "__exemption": [ "examples" ] } }, "updateDayOfYear": { "desc": "Updates the timestamp object with the doy (day of year) information", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object", "__exemption": [ "examples" ] } }, "updateWorkWeek": { "desc": "Updates the timestamp object with the workweek (work week) information", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object", "__exemption": [ "examples" ] } }, "updateDisabled": { "desc": "Updates the timestamp object to be disabled if it matches one of the items from `disabledDays`", "params": { "timestamp": { "extends": "timestamp", "required": true }, "disabledBefore": { "type": "String", "desc": "A date in the form `YYYY-MM-DD` where all dates before, and including, will be disabled", "__exemption": [ "examples" ] }, "disabledAfter": { "type": "String", "desc": "A date in the form `YYYY-MM-DD` where all dates after, and including, will be disabled", "__exemption": [ "examples" ] }, "disabledWeekdays": { "type": "Array", "tsType": "NumberArray", "default": "[]", "desc": "An array of numbers representing the weekdays, where 0=Sunday to 6=Saturday. A value of '[0,6]' would disable the weekend", "examples": [ "[0,6]" ] }, "disabledDays": { "type": "Array", "tsType": "StringArray", "desc": "An array of disabled days. If an array is contained within the array with a start and end date, it will be treated as a range", "examples": [ "['2020-01-01', '2020-07-04']", "['2020-01-01', ['2020-07-04', '2020-07-11']]" ] } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object with `timestamp.disabled` true if a match was found", "__exemption": [ "examples" ] } }, "updateFormatted": { "desc": "Updates the timestamp object with formatted information (`time`, `date`, `weekday`, `doy` and `workweek`)", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object", "__exemption": [ "examples" ] } }, "getDayOfYear": { "desc": "Returns the doy (day of year) for an unformatted timestamp", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Number", "desc": "The day of the year", "__exemption": [ "examples" ] } }, "getWorkWeek": { "desc": "Returns the workweek (work week number) for an unformatted timestamp", "params": { "timestamp": { "extends": "timestamp", "required": false, "desc": "A timestamp object. If no timestamp is passed, then uses current date" } }, "returns": { "type": "Number", "desc": "The work week number of the year. If passed an invalid date, the return value is always 0", "__exemption": [ "examples" ] } }, "getWeekday": { "desc": "Returns the weekday (day of the week) for an unformatted timestamp", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Number", "desc": "The week day number (0=Sunday, 1=Monday, etc)", "__exemption": [ "examples" ] } }, "isLeapYear": { "desc": "Returns true if the passed in year is a leap year", "params": { "year": { "type": "Number", "required": true, "desc": "A number representing the year in YYYY format", "examples": [ "2020", "2021" ] } }, "returns": { "type": "Boolean", "desc": "Returns true if the passed in year is a leap year", "__exemption": [ "examples" ] } }, "daysInMonth": { "desc": "Returns number of days in the spefified month for the specified year (takes into account leap years)", "params": { "year": { "type": "Number", "required": true, "desc": "A number representing the year in YYYY format", "examples": [ "2020", "2021" ] }, "month": { "type": "Number", "required": true, "desc": "A number representing the month from 0 (January) to 11 (December). For performance reasons, no checking is done to validate this value is in range. An exception will occur if it is not", "examples": [ "2020", "2021" ] } }, "returns": { "type": "Number", "desc": "Returns true if the passed in year is a leap year", "__exemption": [ "examples" ] } }, "copyTimestamp": { "desc": "Makes a copy of the passed Timestamp", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A copy of the passed in timestamp object", "__exemption": [ "examples" ] }, "__exemption": [ "examples" ] }, "compareTimestamps": { "desc": "Compares two timestamps", "params": { "timestamp1": { "extends": "timestamp", "required": true }, "timestamp2": { "extends": "timestamp", "required": true } }, "returns": { "type": "Boolean", "desc": "true if timestamps are the same, otherwise false" } }, "compareDate": { "desc": "Compares two timestamps if the dates are the same", "params": { "timestamp1": { "extends": "timestamp", "required": true }, "timestamp2": { "extends": "timestamp", "required": true } }, "returns": { "type": "Boolean", "desc": "true if timestamps dates are the same, otherwise false" } }, "compareTime": { "desc": "Compares two timestamps if the times are the same", "params": { "timestamp1": { "extends": "timestamp", "required": true }, "timestamp2": { "extends": "timestamp", "required": true } }, "returns": { "type": "Boolean", "desc": "true if timestamps times are the same, otherwise false" } }, "compareDateTime": { "desc": "Compares two timestamps if the dates and times are the same", "params": { "timestamp1": { "extends": "timestamp", "required": true }, "timestamp2": { "extends": "timestamp", "required": true } }, "returns": { "type": "Boolean", "desc": "true if timestamps dates and times are the same, otherwise false" } }, "padNumber": { "desc": "Pads the passed in number to the specfied length. Passing in `(2,2)` returns `02`", "params": { "x": { "type": "Number", "desc": "The number to pad", "required": true, "__exemption": [ "examples" ] }, "length": { "type": "Number", "desc": "The length of the paddedIng", "required": true, "__exemption": [ "examples" ] } }, "returns": { "type": "String", "desc": "A padded value", "__exemption": [ "examples" ] }, "__exemption": [ "examples" ] }, "getDate": { "desc": "Returns the timestamp as a padded date", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "String", "desc": "A date as a padded value in the form `YYYY-MM-DD`. Instead of `2020-1-2`, this function formats it as `2020-01-02`", "__exemption": [ "examples" ] }, "__exemption": [ "examples" ] }, "getTime": { "desc": "Returns the timestamp as a padded time", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "String", "desc": "A time as a padded value in the form `hh:mm`. Instead of `2:3`, this function formats it as `02:03`", "__exemption": [ "examples" ] }, "__exemption": [ "examples" ] }, "getDateTime": { "addedIn": "v1.3.11", "desc": "Returns the timestamp as a padded date and time. If time is not available, then only the date will be used", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "String", "desc": "A date and time as a padded value in the form `YYYY-MM-DD hh:mm`. Instead of `2020-1-2 1:20`, this function formats it as `2020-01-02 01:20`", "__exemption": [ "examples" ] }, "__exemption": [ "examples" ] }, "nextDay": { "desc": "Returns the timestamp set to the next day, updating month and year if needed", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object incremented to the next day", "__exemption": [ "examples" ] }, "__exemption": [ "examples" ] }, "prevDay": { "desc": "Returns the timestamp set to the previous day, updating month and year if needed", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object decremented to the next day", "__exemption": [ "examples" ] }, "__exemption": [ "examples" ] }, "relativeDays": { "desc": "Returns the timestamp set to the relative day", "params": { "timestamp": { "extends": "timestamp", "required": true }, "mover": { "type": "Function", "tsType": "TimestampMoveOperation", "default": "# nextDay", "values": [ "# prevDay", "# nextDay" ], "desc": "A reference that points to a function that handles the relative movement from one date to another. If moving backwards, specify `prevDay`", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object", "__exemption": [ "examples" ] } }, "days": { "type": "Number", "default": "1", "desc": "The number of days to move", "__exemption": [ "examples" ] }, "allowedWeekdays": { "type": "Array", "tsType": "NumberArray", "default": "[0,1,2,3,4,5,6]", "desc": "The allow weekdays to use. The method uses this information for allowed days", "examples": [ "[0,1,2,3,4,5,6]", "[1,2,3,4,5,6,0]", "[1,2,3,4,5]" ] } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object moved to the relatively specified days against the `allowedWeekdays`", "__exemption": [ "examples" ] }, "__exemption": [ "examples" ] }, "moveRelativeDays": { "desc": "Returns the timestamp set to the relative day, takes into account allowed weekdays", "addedIn": "v1.5.0", "params": { "timestamp": { "extends": "timestamp", "required": true }, "mover": { "type": "Function", "tsType": "TimestampMoveOperation", "default": "# nextDay", "values": [ "# prevDay", "# nextDay" ], "desc": "A reference that points to a function that handles the relative movement from one date to another. If moving backwards, specify `prevDay`", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object", "__exemption": [ "examples" ] } }, "days": { "type": "Number", "default": "1", "desc": "The number of days to move", "__exemption": [ "examples" ] }, "allowedWeekdays": { "type": "Array", "tsType": "NumberArray", "default": "[0,1,2,3,4,5,6]", "desc": "The allow weekdays to use. The method uses this information for allowed days", "examples": [ "[0,1,2,3,4,5,6]", "[1,2,3,4,5,6,0]", "[1,2,3,4,5]" ] } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object moved to the relatively specified days against the `allowedWeekdays`", "__exemption": [ "examples" ] }, "__exemption": [ "examples" ] }, "findWeekday": { "desc": "Returns the timestamp associated to the specified weekday. Use `parseTimestamp`, not `parsed` (or manually call `updateFormatted` before calling this method), so associated fields are updated correctly, otherwise this function will not work as expected.", "params": { "timestamp": { "extends": "timestamp", "required": true }, "mover": { "type": "Function", "tsType": "TimestampMoveOperation", "default": "# nextDay", "values": [ "# prevDay", "# nextDay" ], "desc": "A reference that points to a function that handles the relative movement from one date to another. If moving backwards, specify `prevDay`", "params": { "timestamp": { "extends": "timestamp", "required": true } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object", "__exemption": [ "examples" ] } }, "maxDays": { "type": "Number", "default": "6", "desc": "The maxiumum number of days to move", "__exemption": [ "examples" ] } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A timestamp object moved to the specified days relatively against the `maxDays`", "__exemption": [ "examples" ] }, "__exemption": [ "examples" ] }, "createDayList": { "desc": "Returns an array of timestamps", "params": { "start": { "extends": "timestamp", "required": true }, "end": { "extends": "timestamp", "required": true }, "now": { "type": "Timestamp", "tsType": "Timestamp", "required": true, "desc": "A timestamp object", "__exemption": [ "examples" ] }, "weekdays": { "type": "Array", "tsType": "NumberArray", "required": true, "desc": "An array of numbers (representing days of the week) that are 0 (=Sunday) to 6 (=Saturday)", "__exemption": [ "examples" ] }, "disabledBefore": { "type": "String", "desc": "A date in the form `YYYY-MM-DD` where all dates before, and including, will be disabled", "__exemption": [ "examples" ] }, "disabledAfter": { "type": "String", "desc": "A date in the form `YYYY-MM-DD` where all dates after, and including, will be disabled", "__exemption": [ "examples" ] }, "disabledWeekdays": { "type": "Array", "tsType": "NumberArray", "default": "[]", "desc": "An array of numbers representing the weekdays, where 0=Sunday to 6=Saturday", "examples": [ "[0,6]" ] }, "disabledDays": { "type": "Array", "tsType": "StringArray", "default": "[]", "desc": "An array of string dates in the form `YYYY-MM-DD` that representing disabled days", "__exemption": [ "examples" ] }, "max": { "type": "Number", "default": "42", "desc": "Maximum days required. 42 is the maxiumum number of days in a full calendar month (6 rows) with `outside` days", "__exemption": [ "examples" ] }, "min": { "type": "Number", "default": "0", "desc": "Minimum days required", "__exemption": [ "examples" ] } }, "returns": { "type": "Array", "tsType": "TimestampArray", "desc": "An array of timestamp objects for all days that meet the criteria", "__exemption": [ "examples" ] }, "__exemption": [ "examples" ] }, "createIntervalList": { "desc": "Returns an array of intervals", "params": { "timestamp": { "extends": "timestamp", "required": true }, "first": { "type": "Number", "required": true, "desc": "The first interval", "__exemption": [ "examples" ] }, "minutes": { "type": "Number", "required": true, "desc": "The number of minutes in an interval", "__exemption": [ "examples" ] }, "count": { "type": "Number", "required": true, "desc": "The count of intervals requested", "__exemption": [ "examples" ] }, "now": { "extends": "timestamp", "required": true, "desc": "A timestamp object that represents 'today' or a specified point in time" } }, "returns": { "type": "Array", "tsType": "TimestampArray", "desc": "A array of interval objects (timestamps with time) that meet the criteria", "__exemption": [ "examples" ] }, "__exemption": [ "examples" ] }, "createNativeLocaleFormatter": { "desc": "Returns a function to be used for international date formatting purposes", "params": { "local": { "type": "String", "required": true, "desc": "A string representing the locale to use (ie: en-US for America)", "__exemption": [ "examples" ] }, "getOptions": { "type": "Function", "tsType": "TimestampFormatOptions", "required": true, "desc": "A function that passes the timestamp and a boolean, and returns an Intl.DateTimeFormatter", "__exemption": [ "examples" ], "params": { "timestamp": { "extends": "timestamp", "required": true }, "short": { "type": "Boolean", "desc": "if true, specifies to use the short version (ie: 'Monday' to be returns as 'Mon', 'January' to be returned as 'Jan', etc)", "__exemption": [ "examples" ] } }, "returns": { "type": "Object", "tsType": "Intl.DateTimeFormatOptions", "desc": "This uses the Intl.DateTimeFormat function of the browser. Options are specified [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat)", "examples": [ "{ timeZone: 'UTC', month: 'long' }", "{ timeZone: 'UTC', month: 'short' }", "{ timeZone: 'UTC', weekday: 'long' }", "{ timeZone: 'UTC', weekday: 'short' }" ] } } }, "returns": { "type": "Function", "desc": "A function that takes a timestamp and a boolean and returns a formatted string.", "tsType": "TimestampFormatter", "params": { "timestamp": { "extends": "timestamp", "required": true }, "short": { "type": "Boolean", "desc": "if true, specifies to use the short version (ie: 'Monday' to be returns as 'Mon', 'January' to be returned as 'Jan', etc)", "__exemption": [ "examples" ] } }, "returns": { "type": "String", "desc": "A string containing the formatted date/time", "__exemption": [ "examples" ] } }, "__exemption": [ "examples" ] }, "validateNumber": { "desc": "Validates that input is a number", "params": { "input": { "type": [ "Number", "String" ], "required": true, "desc": "A numeric value", "examples": [ "# validateNumber(10) // true", "# validateNumber('10') // true", "# validateNumber('bob') // false" ] } }, "returns": { "type": "Boolean", "desc": "true if a number, otherwise false", "__exemption": [ "examples" ] } }, "maxTimestamp": { "desc": "Given an array of Timestamps, returns the highest one", "params": { "timestamps": { "type": "Array", "tsType": "TimestampArray", "desc": "An array of timestamp objects", "required": true, "__exemption": [ "examples" ] }, "useTime": { "type": "Boolean", "desc": "[Optional] Use time in the comparison", "default": "false" } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "The highest valued Timestamp", "__exemption": [ "examples" ] } }, "minTimestamp": { "desc": "Given an array of Timestamps, returns the lowest one", "params": { "timestamps": { "type": "Array", "tsType": "TimestampArray", "desc": "An array of timestamp objects", "required": true, "__exemption": [ "examples" ] }, "useTime": { "type": "Boolean", "desc": "[Optional] Use time in the comparison", "default": "false" } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "The highest valued Timestamp", "__exemption": [ "examples" ] } }, "isBetweenDates": { "addedIn": "v1.3.10", "desc": "Checks passed timestamp is between start and end timestamps", "params": { "timestamp": { "extends": "timestamp", "required": true }, "startTimestamp": { "extends": "timestamp", "desc": "The starting timestamp object to use for the comparison", "required": true }, "endTimestamp": { "extends": "timestamp", "desc": "The ending timestamp object to use for the comparison", "required": true }, "useTime": { "type": "Boolean", "desc": "[Optional] Use time in the comparison", "default": "false" } }, "returns": { "type": "Boolean", "desc": "true if a date is between the start and end dates", "__exemption": [ "examples" ] } }, "isOverlappingDates": { "addedIn": "v1.3.12", "desc": "Checks passed start and end timestamps overlap the first and last timestamps. This method can be used to find if an event, with start and end dates overlap a range, like a week", "examples": [ "# isOverlappingDates(parsed('2020-01-01'), parsed('2020-01-10'), parsed('2019-12-29'), parsed('2020-01-04')) === true", "# isOverlappingDates(parsed('2020-01-01'), parsed('2020-01-10'), parsed('2020-01-29'), parsed('2020-01-30')) === false" ], "params": { "startTimestamp": { "extends": "timestamp", "desc": "The starting timestamp object to use for the comparison", "required": true }, "endTimestamp": { "extends": "timestamp", "desc": "The ending timestamp object to use for the comparison", "required": true }, "firstTimestamp": { "extends": "timestamp", "desc": "The first timestamp object to use for the comparison (typically the first day in a week)", "required": true }, "lastTimestamp": { "extends": "timestamp", "desc": "The last timestamp object to use for the comparison (typically the last day in a week)", "required": true } }, "returns": { "type": "Boolean", "desc": "true if the start and end timestamps overlap the first and last timestamps", "__exemption": [ "examples" ] } }, "daysBetween": { "addedIn": "v1.3.12", "desc": "Returns the number days between two timestamps", "params": { "startTimestamp": { "extends": "timestamp", "desc": "The starting timestamp object to use for the comparison", "required": true }, "endTimestamp": { "extends": "timestamp", "desc": "The ending timestamp object to use for the comparison", "required": true } }, "returns": { "type": "Number", "desc": "The number of days beween the two timestamps", "__exemption": [ "examples" ] } }, "weeksBetween": { "addedIn": "v1.3.12", "desc": "Returns the number weeks between two timestamps", "params": { "startTimestamp": { "extends": "timestamp", "desc": "The starting timestamp object to use for the comparison", "required": true }, "endTimestamp": { "extends": "timestamp", "desc": "The ending timestamp object to use for the comparison", "required": true } }, "returns": { "type": "Number", "desc": "The number of weeks beween the two timestamps", "__exemption": [ "examples" ] } }, "addToDate": { "addedIn": "v1.3.10", "desc": "Takes a timestamp and increments/decrements based on options", "params": { "timestamp": { "extends": "timestamp", "required": true }, "options": { "type": "Object", "tsType": "AddToDateOptions", "desc": "The options passed to the method. All items are optional and can be positive or negative", "required": true, "examples": [ "{ year: 1, month: -1, day: 10, hour: 2, minute: 3 }", "{ month: -1 }", "{ day: 3 }", "{ hour: 10 }", "{ minute: 10000 }" ], "definition": { "year": { "type": [ "Number", "String" ], "desc": "[Optional] The amount to increment/decrement the year", "examples": [ "# { year: 1 }", "# { year: '-1' }" ] }, "month": { "type": [ "Number", "String" ], "desc": "[Optional] The amount to increment/decrement the month", "examples": [ "# { month: 1 }", "# { month: '-1' }" ] }, "day": { "type": [ "Number", "String" ], "desc": "[Optional] The amount to increment/decrement the day", "examples": [ "# { day: 1 }", "# { day: '-1' }" ] }, "hour": { "type": [ "Number", "String" ], "desc": "[Optional] The amount to increment/decrement the hour", "examples": [ "# { hour: 1 }", "# { hour: '-1' }" ] }, "minute": { "type": [ "Number", "String" ], "desc": "[Optional] The amount to increment/decrement the minute", "examples": [ "# { minute: 1 }", "# { minute: '-1' }" ] } } } }, "returns": { "type": "Timestamp", "tsType": "Timestamp", "desc": "A copy of the modified timestamp object with the applied options", "examples": [ "# const ts1 = addToDate(timestamp, { hour: 1 })", "# const ts2 = addToDate(timestamp, { month: 3, hour: -1 })" ] } }, "getWeekdayFormatter": { "desc": "Returns a function to be used for international formatting purposes for the weekday", "params": null, "returns": { "type": "Function", "tsType": "WeekdayFormatter", "desc": "This uses the Intl.DateTimeFormat function of the browser", "params": { "weekday": { "type": "String", "required": true, "values": [ "'Sun'", "'Mon'", "'Tue'", "'Wed'", "'Thu'", "'Fri'", "'Sat'" ], "desc": "The values represent the day of the week (in short form, Pascal-case) in English, but used to translate to the desired locale", "__exemption": [ "examples" ] }, "type": { "type": "String", "default": "'long'", "values": [ "'long'", "'short'", "'narrow'" ], "desc": "The values represent how the day of the week will be displayed", "__exemption": [ "examples" ] }, "locale": { "type": "String", "default": "'en-US'", "desc": "Any locale accepted by the browser can be used", "__exemption": [ "examples" ] } }, "returns": { "type": "String", "desc": "The formatted string of the specified weekday in the desired locale", "__exemption": [ "examples" ] }, "examples": [ "# weekdayFormatter('Mon')", "# weekdayFormatter('Sun', 'long', 'de')", "# weekdayFormatter('Fri', 'short', 'fr')", "# weekdayFormatter('Sat', 'narrow', 'fi')" ] } }, "getWeekdayNames": { "desc": "Returns an array of localized weekday names in either 'long', 'short', or 'narrow' format", "params": { "type": { "type": "String", "default": "'long'", "values": [ "'long'", "'short'", "'narrow'" ], "desc": "The values represent how the day of the week will be displayed", "__exemption": [ "examples" ] }, "locale": { "type": "String", "default": "'en-US'", "desc": "Any locale accepted by the browser can be used", "__exemption": [ "examples" ] } }, "returns": { "type": "Array", "tsType": "StringArray", "desc": "An array of localized weekday names", "examples": [ "[ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ]", "[ 'vuos', 'maŋ', 'gask', 'duor', 'bear', 'láv', 'sotn' ]" ] }, "examples": [ "# getWeekdayNames('long', 'en-US')", "# getWeekdayNames('short', 'se')", "# getWeekdayNames('narrow', 'de')" ] }, "getMonthFormatter": { "desc": "Returns a function to be used for international formatting purposes for the month", "params": null, "returns": { "type": "Function", "tsType": "MonthFormatter", "desc": "This uses the Intl.DateTimeFormat function of the browser", "params": { "month": { "type": "Number", "required": true, "desc": "The values 0-11 can be used to represent the month (0-based) and used to translate to the desired locale", "__exemption": [ "examples" ] }, "type": { "type": "String", "default": "'long'", "values": [ "'long'", "'short'", "'narrow'" ], "desc": "The values represent how the month will be displayed", "__exemption": [ "examples" ] }, "locale": { "type": "String", "default": "'en-US'", "desc": "Any locale accepted by the browser can be used", "__exemption": [ "examples" ] } }, "returns": { "type": "String", "desc": "The formatted string of the specified month in the desired locale", "__exemption": [ "examples" ] }, "examples": [ "# monthFormatter('Mon')", "# monthFormatter('Sun', 'long', 'de')", "# monthFormatter('Fri', 'short', 'fr')", "# monthFormatter('Sat', 'narrow', 'fi')" ] } }, "getMonthNames": { "desc": "Returns an array of localized month names in either 'long', 'short', or 'narrow' format", "params": { "type": { "type": "String", "default": "'long'", "values": [ "'long'", "'short'", "'narrow'" ], "desc": "The values represent how the day of the month will be displayed", "__exemption": [ "examples" ] }, "locale": { "type": "String", "default": "'en-US'", "desc": "Any locale accepted by the browser can be used", "__exemption": [ "examples" ] } }, "returns": { "type": "Array", "tsType": "StringArray", "desc": "An array of localized month names", "examples": [ "[ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ]", "[ 'ođđj', 'guov', 'njuk', 'cuo', 'mies', 'geas', 'suoi', 'borg', 'čakč', 'golg', 'skáb', 'juov' ]" ] }, "examples": [ "# getMonthNames('long',