Global

Methods

relativeTimeToDate(text, nowopt) → {RelativeTimeToDateResult}

Converts human readable relative date string, for example, 'in 10 days' to a date relative to now.

Parameters:
Name Type Attributes Default Description
text string

The text to convert.

now Date <optional>
new Date()

The date from which add or subtract. Default is now.

Returns:
Type:
RelativeTimeToDateResult

Type Definitions

RelativeTimeToDateResult

Properties:
Name Type Description
status string

The conversion status, error if conversion failed or success if conversion succeeded.

info string

The error message if conversion failed, or the relative time indication (past, present, future) if conversion succeeded.

result Date | undefined

The converted date, or undefined if conversion failed.