Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/OfflineQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,21 @@ function equalObjectsGeneric(obj, compareTo, eqlFn) {
}

/**
* Converts human readable relative date string
* ie: 'in 10 days' to a date relative to now
* @typedef RelativeTimeToDateResult
* @property {string} status The conversion status, `error` if conversion failed or
* `success` if conversion succeeded.
* @property {string} info The error message if conversion failed, or the relative
* time indication (`past`, `present`, `future`) if conversion succeeded.
* @property {Date|undefined} result The converted date, or `undefined` if conversion
* failed.
*/
/**
* Converts human readable relative date string, for example, 'in 10 days' to a date
* relative to now.
*
* @param {*} text
* @param {*} now
* @returns {status,info,result}
* copied from parse-server/src/Adapters/Storage/Mongo/MongoTransform.js
* @param {string} text The text to convert.
* @param {Date} [now=new Date()] The date from which add or subtract. Default is now.
* @returns {RelativeTimeToDateResult}
*/
function relativeTimeToDate(text, now = new Date()) {
text = text.toLowerCase();
Expand Down