From 7bf544c5c126eea615947abaf491b478436647df Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Fri, 5 Mar 2021 15:45:33 -0500 Subject: [PATCH 01/24] fixes for consecutive dates and inteval issues --- plugins/dates/package-lock.json | 6 +++--- plugins/dates/package.json | 2 +- plugins/dates/scratch.js | 9 +++++++-- plugins/dates/src/02-ranges/index.js | 16 +++++++++++++++- plugins/dates/src/find.js | 6 +++++- plugins/dates/src/parseDate/parse.js | 5 ----- plugins/dates/src/parseDate/units/Unit.js | 11 +++++++++++ plugins/dates/src/parseDate/units/_day.js | 2 -- plugins/dates/src/parseDate/units/_year.js | 1 + plugins/dates/tests/tokenizer.test.js | 1 + 10 files changed, 44 insertions(+), 15 deletions(-) diff --git a/plugins/dates/package-lock.json b/plugins/dates/package-lock.json index b9acedd5e..e8695f53a 100644 --- a/plugins/dates/package-lock.json +++ b/plugins/dates/package-lock.json @@ -950,9 +950,9 @@ "dev": true }, "spacetime": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/spacetime/-/spacetime-6.13.0.tgz", - "integrity": "sha512-gHOtAjPG2e2VK7o9yNevMrj9oJcACrazTI6pER97PfPF2Vdmp10aJPYc0QnrPmB6zHFJtbVboPk296rIICi0lw==" + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/spacetime/-/spacetime-6.13.1.tgz", + "integrity": "sha512-sXpF4WxTt637z2THlmwfe2OVIIsjPV660NN6oPNsLpFpTt6WtcvImqneWgQJEQDk6S+FfTm4tdiI57Qenb4Idw==" }, "spacetime-holiday": { "version": "0.1.0", diff --git a/plugins/dates/package.json b/plugins/dates/package.json index 26b359933..170094032 100644 --- a/plugins/dates/package.json +++ b/plugins/dates/package.json @@ -49,7 +49,7 @@ "tape": "5.2.2" }, "dependencies": { - "spacetime": "6.13.0", + "spacetime": "6.13.1", "spacetime-holiday": "0.1.0" }, "license": "MIT" diff --git a/plugins/dates/scratch.js b/plugins/dates/scratch.js index a476fc1e6..9ba51fa80 100644 --- a/plugins/dates/scratch.js +++ b/plugins/dates/scratch.js @@ -9,10 +9,15 @@ const fmt = (iso) => (iso ? spacetime(iso).format('{day-short} {nice} {year}') : const context = { // today: '2021-03-01', //monday // today: '2021-03-02', //tuesday - today: '2016-03-05', //on friday + // today: '2016-03-05', //on friday + + dayStart: '10am', + dayEnd: '5pm', } -let doc = nlp('weds').debug() +// let doc = nlp('end of april') +let doc = nlp('saturday evening') + let dates = doc.dates(context).get() dates.forEach((date) => { console.log('start: ', fmt(date.start)) diff --git a/plugins/dates/src/02-ranges/index.js b/plugins/dates/src/02-ranges/index.js index a6b6dc835..05c90c58a 100644 --- a/plugins/dates/src/02-ranges/index.js +++ b/plugins/dates/src/02-ranges/index.js @@ -28,12 +28,26 @@ const parseRange = function (doc, context) { } let unit = parseDate(doc, context) if (unit) { + let end = unit.clone().end() + // 'end of x' shift-up a little bit + if (end.d.epoch === unit.d.epoch) { + unit = unit.beforeEnd() + } res = { start: unit, - end: unit.clone().end(), + end: end, } } let combined = Object.assign({}, interval, res) + + // ensure start is not after end + // console.log(combined) + if (combined.start.d.epoch > combined.end.d.epoch) { + // console.warn('Warning: Start date is after End date') + combined.start = combined.start.start() + // combined.end = combined.start.clone() + } + return combined } module.exports = parseRange diff --git a/plugins/dates/src/find.js b/plugins/dates/src/find.js index b9fd4bee9..80f2077d9 100644 --- a/plugins/dates/src/find.js +++ b/plugins/dates/src/find.js @@ -47,12 +47,16 @@ const findDate = function (doc) { dates = dates.splitOn('#WeekDay') dates = dates.not('^and') } + // '5 june, 10 june' + m = dates.match('[#Value #Month] #Value #Month', 0) + if (m.found) { + dates = dates.splitAfter(m) + } // 'june 5th, june 10th' m = dates.match('[#Month #Value] #Month', 0) if (m.found) { dates = dates.splitAfter(m) } - // '20 minutes june 5th' m = dates.match('[#Cardinal #Duration] #Date', 0) //but allow '20 minutes ago' if (m.found && !dates.has('#Cardinal #Duration] (ago|from|before|after|back)')) { diff --git a/plugins/dates/src/parseDate/parse.js b/plugins/dates/src/parseDate/parse.js index 43fadab38..37402558a 100644 --- a/plugins/dates/src/parseDate/parse.js +++ b/plugins/dates/src/parseDate/parse.js @@ -69,16 +69,11 @@ const parseDate = function (doc, context) { // 2 days after.. if (shift) { unit.applyShift(shift) - // if (shift.hour || shift.minute || shift.second) { - // console.log(shift) - // unit = new Hour(unit.d, null, unit.context) - // } } // wednesday next week if (weekDay && unit.unit !== 'day') { unit.applyWeekDay(weekDay) unit = new WeekDay(unit.d, null, unit.context) - // console.log(rel, unit.d.format()) } // this/next/last if (rel) { diff --git a/plugins/dates/src/parseDate/units/Unit.js b/plugins/dates/src/parseDate/units/Unit.js index 2cae35182..41503e18e 100644 --- a/plugins/dates/src/parseDate/units/Unit.js +++ b/plugins/dates/src/parseDate/units/Unit.js @@ -110,6 +110,17 @@ class Unit { this.d = this.d.add(minutes, 'minutes') return this } + // move it to 3/4s through + beforeEnd() { + let diff = this.d.startOf(this.unit).diff(this.d.endOf(this.unit)) + let mins = Math.round(diff.minutes / 4) + this.d = this.d.endOf(this.unit) + this.d = this.d.minus(mins, 'minutes') + if (this.context.dayStart) { + this.d = this.d.time(this.context.dayStart) + } + return this + } // the millescond before before() { this.d = this.d.minus(1, this.unit) diff --git a/plugins/dates/src/parseDate/units/_day.js b/plugins/dates/src/parseDate/units/_day.js index 8418b02e9..c9488fca5 100644 --- a/plugins/dates/src/parseDate/units/_day.js +++ b/plugins/dates/src/parseDate/units/_day.js @@ -51,11 +51,9 @@ class WeekDay extends Day { } } clone() { - //overloaded method return new WeekDay(this.d, this.unit, this.context) } end() { - //overloaded method this.d = this.d.endOf('day') if (this.context.dayEnd) { this.d = this.d.time(this.context.dayEnd) diff --git a/plugins/dates/src/parseDate/units/_year.js b/plugins/dates/src/parseDate/units/_year.js index cd539789f..82734098f 100644 --- a/plugins/dates/src/parseDate/units/_year.js +++ b/plugins/dates/src/parseDate/units/_year.js @@ -33,6 +33,7 @@ class Month extends Unit { return this } } + class AnyQuarter extends Unit { constructor(input, unit, context) { super(input, unit, context) diff --git a/plugins/dates/tests/tokenizer.test.js b/plugins/dates/tests/tokenizer.test.js index 9a9a44599..2394629cb 100644 --- a/plugins/dates/tests/tokenizer.test.js +++ b/plugins/dates/tests/tokenizer.test.js @@ -31,6 +31,7 @@ test('date-tokenizer', function (t) { ['june and august', 2], ['june and august 2020', 1], ['june, august 9th', 2], + ['15 march 16 march', 2], ] arr.forEach((a) => { let dates = nlp(a[0]).dates() From 8b021a72eff79ef5454289800bc4d63bbd99f9db Mon Sep 17 00:00:00 2001 From: spencer kelly Date: Fri, 5 Mar 2021 15:46:14 -0500 Subject: [PATCH 02/24] 1.4.4 --- plugins/dates/builds/compromise-dates.js | 63 +++++++++++++++----- plugins/dates/builds/compromise-dates.js.map | 2 +- plugins/dates/builds/compromise-dates.min.js | 2 +- plugins/dates/builds/compromise-dates.mjs | 63 +++++++++++++++----- plugins/dates/package.json | 2 +- 5 files changed, 101 insertions(+), 31 deletions(-) diff --git a/plugins/dates/builds/compromise-dates.js b/plugins/dates/builds/compromise-dates.js index 0ec61ec78..6531e9f17 100644 --- a/plugins/dates/builds/compromise-dates.js +++ b/plugins/dates/builds/compromise-dates.js @@ -1,4 +1,4 @@ -/* compromise-dates 1.4.3 MIT */ +/* compromise-dates 1.4.4 MIT */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : @@ -80,7 +80,7 @@ if (typeof Proxy === "function") return true; try { - Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; @@ -658,7 +658,7 @@ return fn(module, module.exports), module.exports; } - /* spencermountain/spacetime 6.13.0 Apache 2.0 */ + /* spencermountain/spacetime 6.13.1 Apache 2.0 */ var spacetime = createCommonjsModule(function (module, exports) { (function (global, factory) { module.exports = factory() ; @@ -4074,7 +4074,12 @@ date: function date(num) { if (num !== undefined) { var s = this.clone(); - s.epoch = set.date(s, num); + num = parseInt(num, 10); + + if (num) { + s.epoch = set.date(s, num); + } + return s; } @@ -5026,7 +5031,7 @@ }; var whereIts_1 = whereIts; - var _version = '6.13.0'; + var _version = '6.13.1'; var main = function main(input, tz, options) { return new spacetime(input, tz, options); @@ -5521,6 +5526,21 @@ var diff = this.d.diff(this.d.endOf(this.unit)); var minutes = Math.round(diff.minutes / 2); this.d = this.d.add(minutes, 'minutes'); + return this; + } // move it to 3/4s through + + }, { + key: "beforeEnd", + value: function beforeEnd() { + var diff = this.d.startOf(this.unit).diff(this.d.endOf(this.unit)); + var mins = Math.round(diff.minutes / 4); + this.d = this.d.endOf(this.unit); + this.d = this.d.minus(mins, 'minutes'); + + if (this.context.dayStart) { + this.d = this.d.time(this.context.dayStart); + } + return this; } // the millescond before @@ -5664,13 +5684,11 @@ _createClass(WeekDay, [{ key: "clone", value: function clone() { - //overloaded method return new WeekDay(this.d, this.unit, this.context); } }, { key: "end", value: function end() { - //overloaded method this.d = this.d.endOf('day'); if (this.context.dayEnd) { @@ -7654,16 +7672,13 @@ if (shift) { - unit.applyShift(shift); // if (shift.hour || shift.minute || shift.second) { - // console.log(shift) - // unit = new Hour(unit.d, null, unit.context) - // } + unit.applyShift(shift); } // wednesday next week if (weekDay && unit.unit !== 'day') { unit.applyWeekDay(weekDay); - unit = new WeekDay(unit.d, null, unit.context); // console.log(rel, unit.d.format()) + unit = new WeekDay(unit.d, null, unit.context); } // this/next/last @@ -8161,13 +8176,26 @@ var unit = parse_1$2(doc, context); if (unit) { + var end = unit.clone().end(); // 'end of x' shift-up a little bit + + if (end.d.epoch === unit.d.epoch) { + unit = unit.beforeEnd(); + } + res = { start: unit, - end: unit.clone().end() + end: end }; } - var combined = Object.assign({}, interval, res); + var combined = Object.assign({}, interval, res); // ensure start is not after end + // console.log(combined) + + if (combined.start.d.epoch > combined.end.d.epoch) { + // console.warn('Warning: Start date is after End date') + combined.start = combined.start.start(); // combined.end = combined.start.clone() + } + return combined; }; @@ -8767,6 +8795,13 @@ if (m.found) { dates = dates.splitOn('#WeekDay'); dates = dates.not('^and'); + } // '5 june, 10 june' + + + m = dates.match('[#Value #Month] #Value #Month', 0); + + if (m.found) { + dates = dates.splitAfter(m); } // 'june 5th, june 10th' diff --git a/plugins/dates/builds/compromise-dates.js.map b/plugins/dates/builds/compromise-dates.js.map index d49a672dd..7f7a87379 100644 --- a/plugins/dates/builds/compromise-dates.js.map +++ b/plugins/dates/builds/compromise-dates.js.map @@ -1 +1 @@ -{"version":3,"file":"compromise-dates.js","sources":["../src/01-tagger/00-basic.js","../src/01-tagger/01-values.js","../src/01-tagger/02-dates.js","../src/01-tagger/03-sections.js","../src/01-tagger/04-time.js","../src/01-tagger/05-shifts.js","../src/01-tagger/06-intervals.js","../src/01-tagger/07-fixup.js","../src/01-tagger/index.js","../src/data/_tags.js","../node_modules/spacetime/builds/spacetime.js","../src/data/_timezones.js","../src/data/words/dates.js","../src/data/words/durations.js","../src/data/words/holidays.js","../src/data/words/times.js","../src/data/words/index.js","../src/parseDate/units/Unit.js","../src/parseDate/units/_day.js","../src/parseDate/units/_year.js","../src/parseDate/units/_week.js","../src/parseDate/units/_time.js","../src/parseDate/units/index.js","../src/parseDate/01-tokenize/01-shift.js","../src/parseDate/01-tokenize/02-counter.js","../src/parseDate/01-tokenize/03-time.js","../src/parseDate/01-tokenize/04-relative.js","../src/parseDate/01-tokenize/05-section.js","../src/parseDate/01-tokenize/06-timezone.js","../src/parseDate/01-tokenize/07-weekday.js","../src/parseDate/02-parse/01-today.js","../node_modules/spacetime-holiday/builds/spacetime-holiday.js","../src/parseDate/02-parse/02-holidays.js","../src/parseDate/02-parse/03-next-last.js","../src/parseDate/02-parse/04-yearly.js","../src/parseDate/02-parse/05-explicit.js","../src/parseDate/03-transform/addCounter.js","../src/parseDate/parse.js","../src/02-ranges/intervals.js","../src/02-ranges/ranges.js","../src/02-ranges/index.js","../src/normalize.js","../src/generate.js","../src/parse.js","../src/data/_abbrevs.js","../src/methods.js","../src/durations/parse.js","../src/durations/index.js","../src/times/parse.js","../src/times/index.js","../src/find.js","../src/index.js"],"sourcesContent":["//ambiguous 'may' and 'march'\nconst preps = '(in|by|before|during|on|until|after|of|within|all)' //6\nconst thisNext = '(last|next|this|previous|current|upcoming|coming)' //2\nconst sections = '(start|end|middle|starting|ending|midpoint|beginning)' //2\nconst seasons = '(spring|summer|winter|fall|autumn)'\n\n//ensure a year is approximately typical for common years\n//please change in one thousand years\nconst tagYear = (m, reason) => {\n if (m.found !== true) {\n return\n }\n m.forEach((p) => {\n let str = p.text('reduced')\n let num = parseInt(str, 10)\n if (num && num > 1000 && num < 3000) {\n p.tag('Year', reason)\n }\n })\n}\n//same, but for less-confident values\nconst tagYearSafe = (m, reason) => {\n if (m.found !== true) {\n return\n }\n m.forEach((p) => {\n let str = p.text('reduced')\n let num = parseInt(str, 10)\n if (num && num > 1900 && num < 2030) {\n p.tag('Year', reason)\n }\n })\n}\n\nconst tagDates = function (doc) {\n // in the evening\n doc.match('in the (night|evening|morning|afternoon|day|daytime)').tag('Time', 'in-the-night')\n // 8 pm\n doc.match('(#Value|#Time) (am|pm)').tag('Time', 'value-ampm')\n // 22-aug\n // doc.match('/^[0-9]{2}-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov)/').tag('Date', '20-jan')\n // 2012-06\n doc.match('/^[0-9]{4}-[0-9]{2}$/').tag('Date', '2012-06')\n\n // misc weekday words\n doc.match('(tue|thu)').tag('WeekDay', 'misc-weekday')\n\n //months:\n let month = doc.if('#Month')\n if (month.found === true) {\n //June 5-7th\n month.match(`#Month #Date+`).tag('Date', 'correction-numberRange')\n //5th of March\n month.match('#Value of #Month').tag('Date', 'value-of-month')\n //5 March\n month.match('#Cardinal #Month').tag('Date', 'cardinal-month')\n //march 5 to 7\n month.match('#Month #Value to #Value').tag('Date', 'value-to-value')\n //march the 12th\n month.match('#Month the #Value').tag('Date', 'month-the-value')\n }\n\n //months:\n let val = doc.if('#Value')\n if (val.found === true) {\n //june 7\n val.match('(#WeekDay|#Month) #Value').ifNo('#Money').tag('Date', 'date-value')\n\n //7 june\n val.match('#Value (#WeekDay|#Month)').ifNo('#Money').tag('Date', 'value-date')\n\n //may twenty five\n val.match('#TextValue #TextValue').if('#Date').tag('#Date', 'textvalue-date')\n\n //two thursdays back\n val.match('#Value (#WeekDay|#Duration) back').tag('#Date', '3-back')\n\n //eg 'year'\n let duration = val.if('#Duration')\n if (duration.found === true) {\n //for 4 months\n duration.match('for #Value #Duration').tag('Date', 'for-x-duration')\n //two days before\n duration.match('#Value #Duration #Conjunction').tag('Date', 'val-duration-conjunction')\n //for four days\n duration.match(`${preps}? #Value #Duration`).tag('Date', 'value-duration')\n //two years old\n duration.match('#Value #Duration old').unTag('Date', 'val-years-old')\n }\n }\n\n //seasons\n let season = doc.if(seasons)\n if (season.found === true) {\n season.match(`${preps}? ${thisNext} ${seasons}`).tag('Date', 'thisNext-season')\n season.match(`the? ${sections} of ${seasons}`).tag('Date', 'section-season')\n season.match(`${seasons} ${preps}? #Cardinal`).tag('Date', 'season-year')\n }\n\n //rest-dates\n let date = doc.if('#Date')\n if (date.found === true) {\n //june the 5th\n date.match('#Date the? #Ordinal').tag('Date', 'correction')\n //last month\n date.match(`${thisNext} #Date`).tag('Date', 'thisNext')\n //by 5 March\n date.match('due? (by|before|after|until) #Date').tag('Date', 'by')\n //next feb\n date.match('(last|next|this|previous|current|upcoming|coming|the) #Date').tag('Date', 'next-feb')\n //start of june\n date.match(`the? ${sections} of #Date`).tag('Date', 'section-of')\n //fifth week in 1998\n date.match('#Ordinal #Duration in #Date').tag('Date', 'duration-in')\n //early in june\n date.match('(early|late) (at|in)? the? #Date').tag('Time', 'early-evening')\n //tomorrow before 3\n date.match('#Date (by|before|after|at|@|about) #Cardinal').not('^#Date').tag('Time', 'date-before-Cardinal')\n //saturday am\n date.match('#Date [(am|pm)]', 0).unTag('Verb').unTag('Copula').tag('Time', 'date-am')\n //feb to june\n date.match('#Date (#Preposition|to) #Date').ifNo('#Duration').tag('Date', 'date-prep-date')\n //2nd quarter of 2019\n // date.match('#Date of #Date').tag('Date', 'date-of-date')\n }\n\n //year/cardinal tagging\n let cardinal = doc.if('#Cardinal')\n if (cardinal.found === true) {\n let v = cardinal.match(`#Date #Value [#Cardinal]`, 0)\n tagYear(v, 'date-value-year')\n //scoops up a bunch\n v = cardinal.match(`#Date [#Cardinal]`, 0)\n tagYearSafe(v, 'date-year')\n //middle of 1999\n v = cardinal.match(`${sections} of [#Cardinal]`)\n tagYearSafe(v, 'section-year')\n //feb 8 2018\n v = cardinal.match(`#Month #Value [#Cardinal]`, 0)\n tagYear(v, 'month-value-year')\n //feb 8 to 10th 2018\n v = cardinal.match(`#Month #Value to #Value [#Cardinal]`, 0)\n tagYear(v, 'month-range-year')\n //in 1998\n v = cardinal.match(`(in|of|by|during|before|starting|ending|for|year|since) [#Cardinal]`, 0)\n tagYear(v, 'in-year-1')\n //q2 2009\n v = cardinal.match('(q1|q2|q3|q4) [#Cardinal]', 0)\n tagYear(v, 'in-year-2')\n //2nd quarter 2009\n v = cardinal.match('#Ordinal quarter of? [#Cardinal]', 0)\n tagYear(v, 'in-year-3')\n //in the year 1998\n v = cardinal.match('the year [#Cardinal]', 0)\n tagYear(v, 'in-year-4')\n //it was 1998\n v = cardinal.match('it (is|was) [#Cardinal]', 0)\n tagYearSafe(v, 'in-year-5')\n // re-tag this part\n cardinal.match(`${sections} of #Year`).tag('Date')\n //between 1999 and 1998\n let m = cardinal.match('between [#Cardinal] and [#Cardinal]')\n tagYear(m.groups('0'), 'between-year-and-year-1')\n tagYear(m.groups('1'), 'between-year-and-year-2')\n }\n\n let time = doc.if('#Time')\n if (time.found === true) {\n //by 6pm\n time.match('(by|before|after|at|@|about) #Time').tag('Time', 'preposition-time')\n //7 7pm\n // time.match('#Cardinal #Time').not('#Year').tag('Time', 'value-time')\n //2pm est\n time.match('#Time [(eastern|pacific|central|mountain)]', 0).tag('Date', 'timezone')\n //6pm est\n time.match('#Time [(est|pst|gmt)]', 0).tag('Date', 'timezone abbr')\n }\n //'2020' bare input\n let m = doc.match('^/^20[012][0-9]$/$')\n tagYearSafe(m, '2020-ish')\n\n // in 20mins\n doc.match('(in|after) /^[0-9]+(min|sec|wk)s?/').tag('Date', 'shift-units')\n //tuesday night\n doc.match('#Date [(now|night|sometime)]', 0).tag('Time', 'date-now')\n // 4 days from now\n doc.match('(from|starting|until|by) now').tag('Date', 'for-now')\n // every night\n doc.match('(each|every) night').tag('Date', 'for-now')\n return doc\n}\nmodule.exports = tagDates\n","const here = 'date-values'\n//\nconst values = function (doc) {\n // a year ago\n if (!doc.has('once [a] #Duration')) {\n doc.match('[a] #Duration', 0).replaceWith('1').tag('Cardinal', here)\n }\n if (doc.has('#Value')) {\n //june 5 to 7th\n doc.match('#Month #Value to #Value of? #Year?').tag('Date', here)\n //5 to 7th june\n doc.match('#Value to #Value of? #Month #Year?').tag('Date', here)\n //third week of may\n doc.match('#Value #Duration of #Date').tag('Date', here)\n //two days after\n doc.match('#Value+ #Duration (after|before|into|later|afterwards|ago)?').tag('Date', here)\n //two days\n doc.match('#Value #Date').tag('Date', here)\n //june 5th\n doc.match('#Date #Value').tag('Date', here)\n //tuesday at 5\n doc.match('#Date #Preposition #Value').tag('Date', here)\n //tomorrow before 3\n doc.match('#Date (after|before|during|on|in) #Value').tag('Date', here)\n //a year and a half\n doc.match('#Value (year|month|week|day) and a half').tag('Date', here)\n //5 and a half years\n doc.match('#Value and a half (years|months|weeks|days)').tag('Date', here)\n //on the fifth\n doc.match('on the #Ordinal').tag('Date', here)\n }\n return doc\n}\nmodule.exports = values\n","const here = 'date-tagger'\n//\nconst dateTagger = function (doc) {\n doc.match('(spring|summer|winter|fall|autumn|springtime|wintertime|summertime)').match('#Noun').tag('Season', here)\n doc.match('(q1|q2|q3|q4)').tag('FinancialQuarter', here)\n doc.match('(this|next|last|current) quarter').tag('FinancialQuarter', here)\n doc.match('(this|next|last|current) season').tag('Season', here)\n\n if (doc.has('#Date')) {\n //friday to sunday\n doc.match('#Date #Preposition #Date').tag('Date', here)\n //once a day..\n doc.match('(once|twice) (a|an|each) #Date').tag('Date', here)\n //tuesday\n doc.match('#Date+').tag('Date', here)\n //by June\n doc.match('(by|until|on|in|at|during|over|every|each|due) the? #Date').tag('Date', 'until-june')\n //a year after..\n doc.match('a #Duration').tag('Date', here)\n //between x and y\n doc.match('(between|from) #Date').tag('Date', here)\n doc.match('(to|until|upto) #Date').tag('Date', here)\n doc.match('#Date and #Date').tag('Date', here)\n //during this june\n doc.match('(by|until|after|before|during|on|in|following|since) (next|this|last)? (#Date|#Date)').tag('Date', here)\n //day after next\n doc.match('the? #Date after next one?').tag('Date', here)\n //approximately...\n doc.match('(about|approx|approximately|around) #Date').tag('Date', here)\n }\n return doc\n}\nmodule.exports = dateTagger\n","const here = 'section-tagger'\n//\nconst sectionTagger = function (doc) {\n if (doc.has('#Date')) {\n // //next september\n doc.match('this? (last|next|past|this|previous|current|upcoming|coming|the) #Date').tag('Date', here)\n //starting this june\n doc.match('(starting|beginning|ending) #Date').tag('Date', here)\n //start of june\n doc.match('the? (start|end|middle|beginning) of (last|next|this|the) (#Date|#Date)').tag('Date', here)\n //this coming june\n doc.match('(the|this) #Date').tag('Date', here)\n //january up to june\n doc.match('#Date up to #Date').tag('Date', here)\n }\n return doc\n}\nmodule.exports = sectionTagger\n","const here = 'time-tagger'\n\n//\nconst timeTagger = function (doc) {\n // 2 oclock\n doc.match('#Cardinal oclock').tag('Time', here)\n // 13h30\n doc.match('/^[0-9]{2}h[0-9]{2}$/').tag('Time', here)\n // 03/02\n doc.match('/^[0-9]{2}/[0-9]{2}/').tag('Date', here).unTag('Value')\n // 3 in the morning\n doc.match('[#Value] (in|at) the? (morning|evening|night|nighttime)').tag('Time', here)\n if (doc.has('#Cardinal') && !doc.has('#Month')) {\n // quarter to seven (not march 5 to 7)\n doc.match('1? (half|quarter|25|15|10|5) (past|after|to) #Cardinal').tag('Time', here)\n // ten to seven\n doc.match('(5|10|15|20|five|ten|fifteen|20) (to|after|past) [#Cardinal]').tag('Time', here) //add check for 1 to 1 etc.\n }\n //timezone\n if (doc.has('#Date')) {\n // iso (2020-03-02T00:00:00.000Z)\n doc.match('/^[0-9]{4}[:-][0-9]{2}[:-][0-9]{2}T[0-9]/').tag('Time', here)\n // tuesday at 4\n doc.match('#Date [at #Cardinal]', 0).notIf('#Year').tag('Time', here)\n // half an hour\n doc.match('half an (hour|minute|second)').tag('Date', here)\n //eastern daylight time\n doc.match('#Noun (standard|daylight|central|mountain)? time').tag('Timezone', here)\n //utc+5\n doc.match('/^utc[+-][0-9]/').tag('Timezone', here)\n doc.match('/^gmt[+-][0-9]/').tag('Timezone', here)\n\n doc.match('(in|for|by|near|at) #Timezone').tag('Timezone', here)\n // 2pm eastern\n doc.match('#Time [(eastern|mountain|pacific|central)]', 0).tag('Timezone', here)\n }\n // around four thirty\n doc.match('(at|around|near) [#Cardinal (thirty|fifteen) (am|pm)?]', 0).tag('Time', here)\n return doc\n}\nmodule.exports = timeTagger\n","const here = 'shift-tagger'\n//\nconst shiftTagger = function (doc) {\n if (doc.has('#Date')) {\n //'two days before'/ 'nine weeks frow now'\n doc.match('#Cardinal #Duration (before|after|ago|from|hence|back)').tag('DateShift', here)\n // in two weeks\n doc.match('in #Cardinal #Duration').tag('DateShift', here)\n // in a few weeks\n doc.match('in a (few|couple) of? #Duration').tag('DateShift', here)\n //two weeks and three days before\n doc.match('#Cardinal #Duration and? #DateShift').tag('DateShift', here)\n doc.match('#DateShift and #Cardinal #Duration').tag('DateShift', here)\n // 'day after tomorrow'\n doc.match('[#Duration (after|before)] #Date', 0).tag('DateShift', here)\n // in half an hour\n doc.match('in half (a|an) #Duration').tag('DateShift', here)\n }\n return doc\n}\nmodule.exports = shiftTagger\n","const tagIntervals = function (doc) {\n // july 3rd and 4th\n doc.match('#Month #Ordinal and #Ordinal').tag('Date', 'ord-and-ord')\n // every other week\n doc.match('every other #Duration').tag('Date', 'every-other')\n // every weekend\n doc.match('(every|any|each|a) (day|weekday|week day|weekend|weekend day)').tag('Date', 'any-weekday')\n // any-wednesday\n doc.match('(every|any|each|a) (#WeekDay)').tag('Date', 'any-wednesday')\n // any week\n doc.match('(every|any|each|a) (#Duration)').tag('Date', 'any-week')\n}\nmodule.exports = tagIntervals\n","const here = 'fix-tagger'\n//\nconst fixUp = function (doc) {\n //fixups\n if (doc.has('#Date')) {\n //first day by monday\n let oops = doc.match('#Date+ by #Date+')\n if (oops.found && !oops.has('^due')) {\n oops.match('^#Date+').unTag('Date', 'by-monday')\n }\n\n let d = doc.match('#Date+')\n //'spa day'\n d.match('^day$').unTag('Date', 'spa-day')\n // tomorrow's meeting\n d.match('(in|of|by|for)? (#Possessive && #Date)').unTag('Date', 'tomorrows meeting')\n\n let knownDate = '(yesterday|today|tomorrow)'\n if (d.has(knownDate)) {\n //yesterday 7\n d.match(`${knownDate} [#Value]$`).unTag('Date', 'yesterday-7')\n //7 yesterday\n d.match(`^[#Value] ${knownDate}$`, 0).unTag('Date', '7 yesterday')\n //friday yesterday\n d.match(`#WeekDay+ ${knownDate}$`).unTag('Date').lastTerm().tag('Date', 'fri-yesterday')\n\n // yesterday yesterday\n // d.match(`${knownDate}+ ${knownDate}$`)\n // .unTag('Date')\n // .lastTerm()\n // .tag('Date', here)\n d.match(`(this|last|next) #Date ${knownDate}$`).unTag('Date').lastTerm().tag('Date', 'this month yesterday')\n }\n //tomorrow on 5\n d.match(`on #Cardinal$`).unTag('Date', here)\n //this tomorrow\n d.match(`this tomorrow`).terms(0).unTag('Date', 'this-tomorrow')\n //q2 2019\n d.match(`(q1|q2|q3|q4) #Year`).tag('Date', here)\n //5 tuesday\n // d.match(`^#Value #WeekDay`).terms(0).unTag('Date');\n //5 next week\n d.match(`^#Value (this|next|last)`).terms(0).unTag('Date', here)\n\n if (d.has('(last|this|next)')) {\n //this month 7\n d.match(`(last|this|next) #Duration #Value`).terms(2).unTag('Date', here)\n //7 this month\n d.match(`!#Month #Value (last|this|next) #Date`).terms(0).unTag('Date', here)\n }\n //january 5 5\n if (d.has('(#Year|#Time|#TextValue|#NumberRange)') === false) {\n d.match('(#Month|#WeekDay) #Value #Value').terms(2).unTag('Date', here)\n }\n //between june\n if (d.has('^between') && !d.has('and .')) {\n d.unTag('Date', here)\n }\n //june june\n if (d.has('#Month #Month') && !d.has('@hasHyphen') && !d.has('@hasComma')) {\n d.match('#Month').lastTerm().unTag('Date', 'month-month')\n }\n // log the hours\n if (d.has('(minutes|seconds|weeks|hours|days|months)') && !d.has('#Value #Duration')) {\n d.match('(minutes|seconds|weeks|hours|days|months)').unTag('Date', 'log-hours')\n }\n // about thanksgiving\n if (d.has('about #Holiday')) {\n d.match('about').unTag('#Date', 'about-thanksgiving')\n }\n\n // second quarter of 2020\n d.match('#Ordinal quarter of? #Year').unTag('Fraction')\n\n // a month from now\n d.match('(from|by|before) now').unTag('Time')\n // dangling date-chunks\n // if (d.has('!#Date (in|of|by|for) !#Date')) {\n // d.unTag('Date', 'dangling-date')\n // }\n // the day after next\n d.match('#Date+').match('^the').unTag('Date')\n }\n return doc\n}\nmodule.exports = fixUp\n","const methods = [\n require('./00-basic'),\n require('./01-values'),\n require('./02-dates'),\n require('./03-sections'),\n require('./04-time'),\n require('./05-shifts'),\n require('./06-intervals'),\n require('./07-fixup'),\n]\n\n// normalizations to run before tagger\nconst normalize = function (doc) {\n // turn '20mins' into '20 mins'\n doc.numbers().normalize() // this is sorta problematic\n return doc\n}\n\n// run each of the taggers\nconst tagDate = function (doc) {\n doc = normalize(doc)\n // run taggers\n methods.forEach((fn) => fn(doc))\n return doc\n}\nmodule.exports = tagDate\n","module.exports = {\n FinancialQuarter: {\n isA: 'Date',\n notA: 'Fraction',\n },\n // 'summer'\n Season: {\n isA: 'Date',\n },\n // '1982'\n Year: {\n isA: ['Date'],\n notA: 'RomanNumeral',\n },\n // 'months'\n Duration: {\n isA: ['Date', 'Noun'],\n },\n // 'easter'\n Holiday: {\n isA: ['Date', 'Noun'],\n },\n // 'PST'\n Timezone: {\n isA: ['Date', 'Noun'],\n notA: ['Adjective', 'DateShift'],\n },\n // 'two weeks before'\n DateShift: {\n isA: ['Date'],\n notA: ['TimeZone', 'Holiday'],\n },\n}\n","/* spencermountain/spacetime 6.13.0 Apache 2.0 */\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.spacetime = factory());\n}(this, (function () { 'use strict';\n\n function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n }\n\n function _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n }\n\n function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n }\n\n function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n }\n\n function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n\n function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n var MSEC_IN_HOUR = 60 * 60 * 1000; //convert our local date syntax a javascript UTC date\n\n var toUtc = function toUtc(dstChange, offset, year) {\n var _dstChange$split = dstChange.split('/'),\n _dstChange$split2 = _slicedToArray(_dstChange$split, 2),\n month = _dstChange$split2[0],\n rest = _dstChange$split2[1];\n\n var _rest$split = rest.split(':'),\n _rest$split2 = _slicedToArray(_rest$split, 2),\n day = _rest$split2[0],\n hour = _rest$split2[1];\n\n return Date.UTC(year, month - 1, day, hour) - offset * MSEC_IN_HOUR;\n }; // compare epoch with dst change events (in utc)\n\n\n var inSummerTime = function inSummerTime(epoch, start, end, summerOffset, winterOffset) {\n var year = new Date(epoch).getUTCFullYear();\n var startUtc = toUtc(start, winterOffset, year);\n var endUtc = toUtc(end, summerOffset, year); // simple number comparison now\n\n return epoch >= startUtc && epoch < endUtc;\n };\n\n var summerTime = inSummerTime;\n\n // it reproduces some things in ./index.js, but speeds up spacetime considerably\n\n var quickOffset = function quickOffset(s) {\n var zones = s.timezones;\n var obj = zones[s.tz];\n\n if (obj === undefined) {\n console.warn(\"Warning: couldn't find timezone \" + s.tz);\n return 0;\n }\n\n if (obj.dst === undefined) {\n return obj.offset;\n } //get our two possible offsets\n\n\n var jul = obj.offset;\n var dec = obj.offset + 1; // assume it's the same for now\n\n if (obj.hem === 'n') {\n dec = jul - 1;\n }\n\n var split = obj.dst.split('->');\n var inSummer = summerTime(s.epoch, split[0], split[1], jul, dec);\n\n if (inSummer === true) {\n return jul;\n }\n\n return dec;\n };\n\n var quick = quickOffset;\n\n var _build = {\n \t\"9|s\": \"2/dili,2/jayapura\",\n \t\"9|n\": \"2/chita,2/khandyga,2/pyongyang,2/seoul,2/tokyo,11/palau\",\n \t\"9.5|s|04/04:03->10/03:02\": \"4/adelaide,4/broken_hill,4/south,4/yancowinna\",\n \t\"9.5|s\": \"4/darwin,4/north\",\n \t\"8|s|03/08:01->10/04:00\": \"12/casey\",\n \t\"8|s\": \"2/kuala_lumpur,2/makassar,2/singapore,4/perth,4/west\",\n \t\"8|n|03/25:03->09/29:23\": \"2/ulan_bator\",\n \t\"8|n\": \"2/brunei,2/choibalsan,2/chongqing,2/chungking,2/harbin,2/hong_kong,2/irkutsk,2/kuching,2/macao,2/macau,2/manila,2/shanghai,2/taipei,2/ujung_pandang,2/ulaanbaatar\",\n \t\"8.75|s\": \"4/eucla\",\n \t\"7|s\": \"12/davis,2/jakarta,9/christmas\",\n \t\"7|n\": \"2/bangkok,2/barnaul,2/ho_chi_minh,2/hovd,2/krasnoyarsk,2/novokuznetsk,2/novosibirsk,2/phnom_penh,2/pontianak,2/saigon,2/tomsk,2/vientiane\",\n \t\"6|s\": \"12/vostok\",\n \t\"6|n\": \"2/almaty,2/bishkek,2/dacca,2/dhaka,2/kashgar,2/omsk,2/qyzylorda,2/qostanay,2/thimbu,2/thimphu,2/urumqi,9/chagos\",\n \t\"6.5|n\": \"2/rangoon,2/yangon,9/cocos\",\n \t\"5|s\": \"12/mawson,9/kerguelen\",\n \t\"5|n\": \"2/aqtau,2/aqtobe,2/ashgabat,2/ashkhabad,2/atyrau,2/baku,2/dushanbe,2/karachi,2/oral,2/samarkand,2/tashkent,2/yekaterinburg,9/maldives\",\n \t\"5.75|n\": \"2/kathmandu,2/katmandu\",\n \t\"5.5|n\": \"2/calcutta,2/colombo,2/kolkata\",\n \t\"4|s\": \"9/reunion\",\n \t\"4|n\": \"2/dubai,2/muscat,2/tbilisi,2/yerevan,8/astrakhan,8/samara,8/saratov,8/ulyanovsk,8/volgograd,2/volgograd,9/mahe,9/mauritius\",\n \t\"4.5|n|03/22:00->09/21:24\": \"2/tehran\",\n \t\"4.5|n\": \"2/kabul\",\n \t\"3|s\": \"12/syowa,9/antananarivo\",\n \t\"3|n|03/28:03->10/31:04\": \"2/famagusta,2/nicosia,8/athens,8/bucharest,8/helsinki,8/kiev,8/mariehamn,8/nicosia,8/riga,8/sofia,8/tallinn,8/uzhgorod,8/vilnius,8/zaporozhye\",\n \t\"3|n|03/28:02->10/31:03\": \"8/chisinau,8/tiraspol\",\n \t\"3|n|03/28:00->10/30:24\": \"2/beirut\",\n \t\"3|n|03/27:00->10/30:01\": \"2/gaza,2/hebron\",\n \t\"3|n|03/26:02->10/31:02\": \"2/jerusalem,2/tel_aviv\",\n \t\"3|n|03/26:00->10/29:01\": \"2/amman\",\n \t\"3|n|03/26:00->10/28:24\": \"2/damascus\",\n \t\"3|n\": \"0/addis_ababa,0/asmara,0/asmera,0/dar_es_salaam,0/djibouti,0/juba,0/kampala,0/mogadishu,0/nairobi,2/aden,2/baghdad,2/bahrain,2/istanbul,2/kuwait,2/qatar,2/riyadh,8/istanbul,8/kirov,8/minsk,8/moscow,8/simferopol,9/comoro,9/mayotte\",\n \t\"2|s|03/28:02->10/31:02\": \"12/troll\",\n \t\"2|s\": \"0/gaborone,0/harare,0/johannesburg,0/lubumbashi,0/lusaka,0/maputo,0/maseru,0/mbabane\",\n \t\"2|n|03/28:02->10/31:03\": \"0/ceuta,arctic/longyearbyen,3/jan_mayen,8/amsterdam,8/andorra,8/belgrade,8/berlin,8/bratislava,8/brussels,8/budapest,8/busingen,8/copenhagen,8/gibraltar,8/ljubljana,8/luxembourg,8/madrid,8/malta,8/monaco,8/oslo,8/paris,8/podgorica,8/prague,8/rome,8/san_marino,8/sarajevo,8/skopje,8/stockholm,8/tirane,8/vaduz,8/vatican,8/vienna,8/warsaw,8/zagreb,8/zurich\",\n \t\"2|n\": \"0/blantyre,0/bujumbura,0/cairo,0/khartoum,0/kigali,0/tripoli,8/kaliningrad\",\n \t\"1|s|04/02:01->09/03:03\": \"0/windhoek\",\n \t\"1|s\": \"0/kinshasa,0/luanda\",\n \t\"1|n|04/11:03->05/16:02\": \"0/casablanca,0/el_aaiun\",\n \t\"1|n|03/28:01->10/31:02\": \"3/canary,3/faeroe,3/faroe,3/madeira,8/belfast,8/dublin,8/guernsey,8/isle_of_man,8/jersey,8/lisbon,8/london\",\n \t\"1|n\": \"0/algiers,0/bangui,0/brazzaville,0/douala,0/lagos,0/libreville,0/malabo,0/ndjamena,0/niamey,0/porto-novo,0/tunis\",\n \t\"14|n\": \"11/kiritimati\",\n \t\"13|s|04/04:04->09/26:03\": \"11/apia\",\n \t\"13|s|01/15:02->11/05:03\": \"11/tongatapu\",\n \t\"13|n\": \"11/enderbury,11/fakaofo\",\n \t\"12|s|04/04:03->09/26:02\": \"12/mcmurdo,12/south_pole,11/auckland\",\n \t\"12|s|01/17:03->11/14:02\": \"11/fiji\",\n \t\"12|n\": \"2/anadyr,2/kamchatka,2/srednekolymsk,11/funafuti,11/kwajalein,11/majuro,11/nauru,11/tarawa,11/wake,11/wallis\",\n \t\"12.75|s|04/04:03->04/04:02\": \"11/chatham\",\n \t\"11|s|04/04:03->10/03:02\": \"12/macquarie\",\n \t\"11|s\": \"11/bougainville\",\n \t\"11|n\": \"2/magadan,2/sakhalin,11/efate,11/guadalcanal,11/kosrae,11/noumea,11/pohnpei,11/ponape\",\n \t\"11.5|n|04/04:03->10/03:02\": \"11/norfolk\",\n \t\"10|s|04/04:03->10/03:02\": \"4/act,4/canberra,4/currie,4/hobart,4/melbourne,4/nsw,4/sydney,4/tasmania,4/victoria\",\n \t\"10|s\": \"12/dumontdurville,4/brisbane,4/lindeman,4/queensland\",\n \t\"10|n\": \"2/ust-nera,2/vladivostok,2/yakutsk,11/chuuk,11/guam,11/port_moresby,11/saipan,11/truk,11/yap\",\n \t\"10.5|s|04/04:01->10/03:02\": \"4/lhi,4/lord_howe\",\n \t\"0|n|03/28:00->10/31:01\": \"1/scoresbysund,3/azores\",\n \t\"0|n\": \"0/abidjan,0/accra,0/bamako,0/banjul,0/bissau,0/conakry,0/dakar,0/freetown,0/lome,0/monrovia,0/nouakchott,0/ouagadougou,0/sao_tome,0/timbuktu,1/danmarkshavn,3/reykjavik,3/st_helena,13/gmt,13/gmt+0,13/gmt-0,13/gmt0,13/greenwich,13/utc,13/universal,13/zulu\",\n \t\"-9|n|03/14:02->11/07:02\": \"1/adak,1/atka\",\n \t\"-9|n\": \"11/gambier\",\n \t\"-9.5|n\": \"11/marquesas\",\n \t\"-8|n|03/14:02->11/07:02\": \"1/anchorage,1/juneau,1/metlakatla,1/nome,1/sitka,1/yakutat\",\n \t\"-8|n\": \"11/pitcairn\",\n \t\"-7|n|03/14:02->11/07:02\": \"1/ensenada,1/los_angeles,1/santa_isabel,1/tijuana,1/vancouver,6/pacific,10/bajanorte\",\n \t\"-7|n|03/08:02->11/01:01\": \"1/dawson,1/whitehorse,6/yukon\",\n \t\"-7|n\": \"1/creston,1/dawson_creek,1/fort_nelson,1/hermosillo,1/phoenix\",\n \t\"-6|s|04/03:22->09/04:22\": \"7/easterisland,11/easter\",\n \t\"-6|n|04/04:02->10/31:02\": \"1/chihuahua,1/mazatlan,10/bajasur\",\n \t\"-6|n|03/14:02->11/07:02\": \"1/boise,1/cambridge_bay,1/denver,1/edmonton,1/inuvik,1/ojinaga,1/shiprock,1/yellowknife,6/mountain\",\n \t\"-6|n\": \"1/belize,1/costa_rica,1/el_salvador,1/guatemala,1/managua,1/regina,1/swift_current,1/tegucigalpa,6/east-saskatchewan,6/saskatchewan,11/galapagos\",\n \t\"-5|s\": \"1/lima,1/rio_branco,5/acre\",\n \t\"-5|n|04/04:02->10/31:02\": \"1/bahia_banderas,1/merida,1/mexico_city,1/monterrey,10/general\",\n \t\"-5|n|03/14:02->11/07:02\": \"1/chicago,1/knox_in,1/matamoros,1/menominee,1/rainy_river,1/rankin_inlet,1/resolute,1/winnipeg,6/central\",\n \t\"-5|n|03/12:03->11/05:01\": \"1/north_dakota\",\n \t\"-5|n\": \"1/atikokan,1/bogota,1/cancun,1/cayman,1/coral_harbour,1/eirunepe,1/guayaquil,1/jamaica,1/panama,1/porto_acre\",\n \t\"-4|s|05/13:23->08/13:01\": \"12/palmer\",\n \t\"-4|s|04/03:24->09/05:00\": \"1/santiago,7/continental\",\n \t\"-4|s|03/27:24->10/03:00\": \"1/asuncion\",\n \t\"-4|s|02/16:24->11/03:00\": \"1/campo_grande,1/cuiaba\",\n \t\"-4|s\": \"1/la_paz,1/manaus,5/west\",\n \t\"-4|n|03/14:02->11/07:02\": \"1/detroit,1/fort_wayne,1/grand_turk,1/indianapolis,1/iqaluit,1/louisville,1/montreal,1/nassau,1/new_york,1/nipigon,1/pangnirtung,1/port-au-prince,1/thunder_bay,1/toronto,6/eastern\",\n \t\"-4|n|03/14:00->11/07:01\": \"1/havana\",\n \t\"-4|n|03/12:03->11/05:01\": \"1/indiana,1/kentucky\",\n \t\"-4|n\": \"1/anguilla,1/antigua,1/aruba,1/barbados,1/blanc-sablon,1/boa_vista,1/caracas,1/curacao,1/dominica,1/grenada,1/guadeloupe,1/guyana,1/kralendijk,1/lower_princes,1/marigot,1/martinique,1/montserrat,1/port_of_spain,1/porto_velho,1/puerto_rico,1/santo_domingo,1/st_barthelemy,1/st_kitts,1/st_lucia,1/st_thomas,1/st_vincent,1/tortola,1/virgin\",\n \t\"-3|s\": \"1/argentina,1/buenos_aires,1/cordoba,1/fortaleza,1/montevideo,1/punta_arenas,1/sao_paulo,12/rothera,3/stanley,5/east\",\n \t\"-3|n|03/27:22->10/30:23\": \"1/nuuk\",\n \t\"-3|n|03/14:02->11/07:02\": \"1/glace_bay,1/goose_bay,1/halifax,1/moncton,1/thule,3/bermuda,6/atlantic\",\n \t\"-3|n\": \"1/araguaina,1/bahia,1/belem,1/catamarca,1/cayenne,1/jujuy,1/maceio,1/mendoza,1/paramaribo,1/recife,1/rosario,1/santarem\",\n \t\"-2|s\": \"5/denoronha\",\n \t\"-2|n|03/27:22->10/30:23\": \"1/godthab\",\n \t\"-2|n|03/14:02->11/07:02\": \"1/miquelon\",\n \t\"-2|n\": \"1/noronha,3/south_georgia\",\n \t\"-2.5|n|03/14:02->11/07:02\": \"1/st_johns,6/newfoundland\",\n \t\"-1|n\": \"3/cape_verde\",\n \t\"-11|n\": \"11/midway,11/niue,11/pago_pago,11/samoa\",\n \t\"-10|n\": \"11/honolulu,11/johnston,11/rarotonga,11/tahiti\"\n };\n\n var _build$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n 'default': _build\n });\n\n //prefixes for iana names..\n var _prefixes = ['africa', 'america', 'asia', 'atlantic', 'australia', 'brazil', 'canada', 'chile', 'europe', 'indian', 'mexico', 'pacific', 'antarctica', 'etc'];\n\n function createCommonjsModule(fn, module) {\n \treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n }\n\n function getCjsExportFromNamespace (n) {\n \treturn n && n['default'] || n;\n }\n\n var data = getCjsExportFromNamespace(_build$1);\n\n var all = {};\n Object.keys(data).forEach(function (k) {\n var split = k.split('|');\n var obj = {\n offset: Number(split[0]),\n hem: split[1]\n };\n\n if (split[2]) {\n obj.dst = split[2];\n }\n\n var names = data[k].split(',');\n names.forEach(function (str) {\n str = str.replace(/(^[0-9]+)\\//, function (before, num) {\n num = Number(num);\n return _prefixes[num] + '/';\n });\n all[str] = obj;\n });\n });\n all['utc'] = {\n offset: 0,\n hem: 'n' //default to northern hemisphere - (sorry!)\n\n }; //add etc/gmt+n\n\n for (var i = -14; i <= 14; i += 0.5) {\n var num = i;\n\n if (num > 0) {\n num = '+' + num;\n }\n\n var name = 'etc/gmt' + num;\n all[name] = {\n offset: i * -1,\n //they're negative!\n hem: 'n' //(sorry)\n\n };\n name = 'utc/gmt' + num; //this one too, why not.\n\n all[name] = {\n offset: i * -1,\n hem: 'n'\n };\n }\n\n var unpack = all;\n\n //find the implicit iana code for this machine.\n //safely query the Intl object\n //based on - https://bitbucket.org/pellepim/jstimezonedetect/src\n var fallbackTZ = 'utc'; //\n //this Intl object is not supported often, yet\n\n var safeIntl = function safeIntl() {\n if (typeof Intl === 'undefined' || typeof Intl.DateTimeFormat === 'undefined') {\n return null;\n }\n\n var format = Intl.DateTimeFormat();\n\n if (typeof format === 'undefined' || typeof format.resolvedOptions === 'undefined') {\n return null;\n }\n\n var timezone = format.resolvedOptions().timeZone;\n\n if (!timezone) {\n return null;\n }\n\n return timezone.toLowerCase();\n };\n\n var guessTz = function guessTz() {\n var timezone = safeIntl();\n\n if (timezone === null) {\n return fallbackTZ;\n }\n\n return timezone;\n }; //do it once per computer\n\n\n var guessTz_1 = guessTz;\n\n var isOffset = /(\\-?[0-9]+)h(rs)?/i;\n var isNumber = /(\\-?[0-9]+)/;\n var utcOffset = /utc([\\-+]?[0-9]+)/i;\n var gmtOffset = /gmt([\\-+]?[0-9]+)/i;\n\n var toIana = function toIana(num) {\n num = Number(num);\n\n if (num >= -13 && num <= 13) {\n num = num * -1; //it's opposite!\n\n num = (num > 0 ? '+' : '') + num; //add plus sign\n\n return 'etc/gmt' + num;\n }\n\n return null;\n };\n\n var parseOffset$1 = function parseOffset(tz) {\n // '+5hrs'\n var m = tz.match(isOffset);\n\n if (m !== null) {\n return toIana(m[1]);\n } // 'utc+5'\n\n\n m = tz.match(utcOffset);\n\n if (m !== null) {\n return toIana(m[1]);\n } // 'GMT-5' (not opposite)\n\n\n m = tz.match(gmtOffset);\n\n if (m !== null) {\n var num = Number(m[1]) * -1;\n return toIana(num);\n } // '+5'\n\n\n m = tz.match(isNumber);\n\n if (m !== null) {\n return toIana(m[1]);\n }\n\n return null;\n };\n\n var parseOffset_1$1 = parseOffset$1;\n\n var local = guessTz_1(); //add all the city names by themselves\n\n var cities = Object.keys(unpack).reduce(function (h, k) {\n var city = k.split('/')[1] || '';\n city = city.replace(/_/g, ' ');\n h[city] = k;\n return h;\n }, {}); //try to match these against iana form\n\n var normalize = function normalize(tz) {\n tz = tz.replace(/ time/g, '');\n tz = tz.replace(/ (standard|daylight|summer)/g, '');\n tz = tz.replace(/\\b(east|west|north|south)ern/g, '$1');\n tz = tz.replace(/\\b(africa|america|australia)n/g, '$1');\n tz = tz.replace(/\\beuropean/g, 'europe');\n tz = tz.replace(/\\islands/g, 'island');\n return tz;\n }; // try our best to reconcile the timzone to this given string\n\n\n var lookupTz = function lookupTz(str, zones) {\n if (!str) {\n return local;\n }\n\n if (typeof str !== 'string') {\n console.error(\"Timezone must be a string - recieved: '\", str, \"'\\n\");\n }\n\n var tz = str.trim();\n var split = str.split('/'); //support long timezones like 'America/Argentina/Rio_Gallegos'\n\n if (split.length > 2 && zones.hasOwnProperty(tz) === false) {\n tz = split[0] + '/' + split[1];\n }\n\n tz = tz.toLowerCase();\n\n if (zones.hasOwnProperty(tz) === true) {\n return tz;\n } //lookup more loosely..\n\n\n tz = normalize(tz);\n\n if (zones.hasOwnProperty(tz) === true) {\n return tz;\n } //try city-names\n\n\n if (cities.hasOwnProperty(tz) === true) {\n return cities[tz];\n } // //try to parse '-5h'\n\n\n if (/[0-9]/.test(tz) === true) {\n var id = parseOffset_1$1(tz);\n\n if (id) {\n return id;\n }\n }\n\n throw new Error(\"Spacetime: Cannot find timezone named: '\" + str + \"'. Please enter an IANA timezone id.\");\n };\n\n var find = lookupTz;\n\n var o = {\n millisecond: 1\n };\n o.second = 1000;\n o.minute = 60000;\n o.hour = 3.6e6; // dst is supported post-hoc\n\n o.day = 8.64e7; //\n\n o.date = o.day;\n o.month = 8.64e7 * 29.5; //(average)\n\n o.week = 6.048e8;\n o.year = 3.154e10; // leap-years are supported post-hoc\n //add plurals\n\n Object.keys(o).forEach(function (k) {\n o[k + 's'] = o[k];\n });\n var milliseconds = o;\n\n var walk = function walk(s, n, fn, unit, previous) {\n var current = s.d[fn]();\n\n if (current === n) {\n return; //already there\n }\n\n var startUnit = previous === null ? null : s.d[previous]();\n var original = s.epoch; //try to get it as close as we can\n\n var diff = n - current;\n s.epoch += milliseconds[unit] * diff; //DST edge-case: if we are going many days, be a little conservative\n // console.log(unit, diff)\n\n if (unit === 'day') {\n // s.epoch -= ms.minute\n //but don't push it over a month\n if (Math.abs(diff) > 28 && n < 28) {\n s.epoch += milliseconds.hour;\n }\n } // 1st time: oops, did we change previous unit? revert it.\n\n\n if (previous !== null && startUnit !== s.d[previous]()) {\n // console.warn('spacetime warning: missed setting ' + unit)\n s.epoch = original; // s.epoch += ms[unit] * diff * 0.89 // maybe try and make it close...?\n } //repair it if we've gone too far or something\n //(go by half-steps, just in case)\n\n\n var halfStep = milliseconds[unit] / 2;\n\n while (s.d[fn]() < n) {\n s.epoch += halfStep;\n }\n\n while (s.d[fn]() > n) {\n s.epoch -= halfStep;\n } // 2nd time: did we change previous unit? revert it.\n\n\n if (previous !== null && startUnit !== s.d[previous]()) {\n // console.warn('spacetime warning: missed setting ' + unit)\n s.epoch = original;\n }\n }; //find the desired date by a increment/check while loop\n\n\n var units$3 = {\n year: {\n valid: function valid(n) {\n return n > -4000 && n < 4000;\n },\n walkTo: function walkTo(s, n) {\n return walk(s, n, 'getFullYear', 'year', null);\n }\n },\n month: {\n valid: function valid(n) {\n return n >= 0 && n <= 11;\n },\n walkTo: function walkTo(s, n) {\n var d = s.d;\n var current = d.getMonth();\n var original = s.epoch;\n var startUnit = d.getFullYear();\n\n if (current === n) {\n return;\n } //try to get it as close as we can..\n\n\n var diff = n - current;\n s.epoch += milliseconds.day * (diff * 28); //special case\n //oops, did we change the year? revert it.\n\n if (startUnit !== s.d.getFullYear()) {\n s.epoch = original;\n } //increment by day\n\n\n while (s.d.getMonth() < n) {\n s.epoch += milliseconds.day;\n }\n\n while (s.d.getMonth() > n) {\n s.epoch -= milliseconds.day;\n }\n }\n },\n date: {\n valid: function valid(n) {\n return n > 0 && n <= 31;\n },\n walkTo: function walkTo(s, n) {\n return walk(s, n, 'getDate', 'day', 'getMonth');\n }\n },\n hour: {\n valid: function valid(n) {\n return n >= 0 && n < 24;\n },\n walkTo: function walkTo(s, n) {\n return walk(s, n, 'getHours', 'hour', 'getDate');\n }\n },\n minute: {\n valid: function valid(n) {\n return n >= 0 && n < 60;\n },\n walkTo: function walkTo(s, n) {\n return walk(s, n, 'getMinutes', 'minute', 'getHours');\n }\n },\n second: {\n valid: function valid(n) {\n return n >= 0 && n < 60;\n },\n walkTo: function walkTo(s, n) {\n //do this one directly\n s.epoch = s.seconds(n).epoch;\n }\n },\n millisecond: {\n valid: function valid(n) {\n return n >= 0 && n < 1000;\n },\n walkTo: function walkTo(s, n) {\n //do this one directly\n s.epoch = s.milliseconds(n).epoch;\n }\n }\n };\n\n var walkTo = function walkTo(s, wants) {\n var keys = Object.keys(units$3);\n var old = s.clone();\n\n for (var i = 0; i < keys.length; i++) {\n var k = keys[i];\n var n = wants[k];\n\n if (n === undefined) {\n n = old[k]();\n }\n\n if (typeof n === 'string') {\n n = parseInt(n, 10);\n } //make-sure it's valid\n\n\n if (!units$3[k].valid(n)) {\n s.epoch = null;\n\n if (s.silent === false) {\n console.warn('invalid ' + k + ': ' + n);\n }\n\n return;\n }\n\n units$3[k].walkTo(s, n);\n }\n\n return;\n };\n\n var walk_1 = walkTo;\n\n var shortMonths = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sept', 'oct', 'nov', 'dec'];\n var longMonths = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];\n\n function buildMapping() {\n var obj = {\n sep: 8 //support this format\n\n };\n\n for (var i = 0; i < shortMonths.length; i++) {\n obj[shortMonths[i]] = i;\n }\n\n for (var _i = 0; _i < longMonths.length; _i++) {\n obj[longMonths[_i]] = _i;\n }\n\n return obj;\n }\n\n var months$1 = {\n \"short\": function short() {\n return shortMonths;\n },\n \"long\": function long() {\n return longMonths;\n },\n mapping: function mapping() {\n return buildMapping();\n },\n set: function set(i18n) {\n shortMonths = i18n[\"short\"] || shortMonths;\n longMonths = i18n[\"long\"] || longMonths;\n }\n };\n\n //pull-apart ISO offsets, like \"+0100\"\n var parseOffset = function parseOffset(s, offset) {\n if (!offset) {\n return s;\n } //this is a fancy-move\n\n\n if (offset === 'Z' || offset === 'z') {\n offset = '+0000';\n } // according to ISO8601, tz could be hh:mm, hhmm or hh\n // so need few more steps before the calculation.\n\n\n var num = 0; // for (+-)hh:mm\n\n if (/^[\\+-]?[0-9]{2}:[0-9]{2}$/.test(offset)) {\n //support \"+01:00\"\n if (/:00/.test(offset) === true) {\n offset = offset.replace(/:00/, '');\n } //support \"+01:30\"\n\n\n if (/:30/.test(offset) === true) {\n offset = offset.replace(/:30/, '.5');\n }\n } // for (+-)hhmm\n\n\n if (/^[\\+-]?[0-9]{4}$/.test(offset)) {\n offset = offset.replace(/30$/, '.5');\n }\n\n num = parseFloat(offset); //divide by 100 or 10 - , \"+0100\", \"+01\"\n\n if (Math.abs(num) > 100) {\n num = num / 100;\n } //okay, try to match it to a utc timezone\n //remember - this is opposite! a -5 offset maps to Etc/GMT+5 ¯\\_(:/)_/¯\n //https://askubuntu.com/questions/519550/why-is-the-8-timezone-called-gmt-8-in-the-filesystem\n\n\n num *= -1;\n\n if (num >= 0) {\n num = '+' + num;\n }\n\n var tz = 'etc/gmt' + num;\n var zones = s.timezones;\n\n if (zones[tz]) {\n // log a warning if we're over-writing a given timezone?\n // console.log('changing timezone to: ' + tz)\n s.tz = tz;\n }\n\n return s;\n };\n\n var parseOffset_1 = parseOffset;\n\n var parseTime = function parseTime(s) {\n var str = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n str = str.replace(/^\\s+/, '').toLowerCase(); //trim\n //formal time formats - 04:30.23\n\n var arr = str.match(/([0-9]{1,2}):([0-9]{1,2}):?([0-9]{1,2})?[:\\.]?([0-9]{1,4})?/);\n\n if (arr !== null) {\n //validate it a little\n var h = Number(arr[1]);\n\n if (h < 0 || h > 24) {\n return s.startOf('day');\n }\n\n var m = Number(arr[2]); //don't accept '5:3pm'\n\n if (arr[2].length < 2 || m < 0 || m > 59) {\n return s.startOf('day');\n }\n\n if (arr[4] > 999) {\n // fix overflow issue with milliseconds, if input is longer than standard (e.g. 2017-08-06T09:00:00.123456Z)\n arr[4] = parseInt(\"\".concat(arr[4]).substring(0, 3), 10);\n }\n\n s = s.hour(h);\n s = s.minute(m);\n s = s.seconds(arr[3] || 0);\n s = s.millisecond(arr[4] || 0); //parse-out am/pm\n\n var ampm = str.match(/[\\b0-9](am|pm)\\b/);\n\n if (ampm !== null && ampm[1]) {\n s = s.ampm(ampm[1]);\n }\n\n return s;\n } //try an informal form - 5pm (no minutes)\n\n\n arr = str.match(/([0-9]+) ?(am|pm)/);\n\n if (arr !== null && arr[1]) {\n var _h = Number(arr[1]); //validate it a little..\n\n\n if (_h > 12 || _h < 1) {\n return s.startOf('day');\n }\n\n s = s.hour(arr[1] || 0);\n s = s.ampm(arr[2]);\n s = s.startOf('hour');\n return s;\n } //no time info found, use start-of-day\n\n\n s = s.startOf('day');\n return s;\n };\n\n var parseTime_1 = parseTime;\n\n var monthLengths = [31, // January - 31 days\n 28, // February - 28 days in a common year and 29 days in leap years\n 31, // March - 31 days\n 30, // April - 30 days\n 31, // May - 31 days\n 30, // June - 30 days\n 31, // July - 31 days\n 31, // August - 31 days\n 30, // September - 30 days\n 31, // October - 31 days\n 30, // November - 30 days\n 31 // December - 31 days\n ];\n var monthLengths_1 = monthLengths; // 28 - feb\n\n var fns = createCommonjsModule(function (module, exports) {\n //git:blame @JuliasCaesar https://www.timeanddate.com/date/leapyear.html\n exports.isLeapYear = function (year) {\n return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;\n }; // unsurprisingly-nasty `typeof date` call\n\n\n exports.isDate = function (d) {\n return Object.prototype.toString.call(d) === '[object Date]' && !isNaN(d.valueOf());\n };\n\n exports.isArray = function (input) {\n return Object.prototype.toString.call(input) === '[object Array]';\n };\n\n exports.isObject = function (input) {\n return Object.prototype.toString.call(input) === '[object Object]';\n };\n\n exports.isBoolean = function (input) {\n return Object.prototype.toString.call(input) === '[object Boolean]';\n };\n\n exports.zeroPad = function (str) {\n var len = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;\n var pad = '0';\n str = str + '';\n return str.length >= len ? str : new Array(len - str.length + 1).join(pad) + str;\n };\n\n exports.titleCase = function (str) {\n if (!str) {\n return '';\n }\n\n return str[0].toUpperCase() + str.substr(1);\n };\n\n exports.ordinal = function (i) {\n var j = i % 10;\n var k = i % 100;\n\n if (j === 1 && k !== 11) {\n return i + 'st';\n }\n\n if (j === 2 && k !== 12) {\n return i + 'nd';\n }\n\n if (j === 3 && k !== 13) {\n return i + 'rd';\n }\n\n return i + 'th';\n }; //strip 'st' off '1st'..\n\n\n exports.toCardinal = function (str) {\n str = String(str);\n str = str.replace(/([0-9])(st|nd|rd|th)$/i, '$1');\n return parseInt(str, 10);\n }; //used mostly for cleanup of unit names, like 'months'\n\n\n exports.normalize = function () {\n var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n str = str.toLowerCase().trim();\n str = str.replace(/ies$/, 'y'); //'centuries'\n\n str = str.replace(/s$/, '');\n str = str.replace(/-/g, '');\n\n if (str === 'day' || str === 'days') {\n return 'date';\n }\n\n if (str === 'min' || str === 'mins') {\n return 'minute';\n }\n\n return str;\n };\n\n exports.getEpoch = function (tmp) {\n //support epoch\n if (typeof tmp === 'number') {\n return tmp;\n } //suport date objects\n\n\n if (exports.isDate(tmp)) {\n return tmp.getTime();\n }\n\n if (tmp.epoch) {\n return tmp.epoch;\n }\n\n return null;\n }; //make sure this input is a spacetime obj\n\n\n exports.beADate = function (d, s) {\n if (exports.isObject(d) === false) {\n return s.clone().set(d);\n }\n\n return d;\n };\n\n exports.formatTimezone = function (offset) {\n var delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var sign = offset > 0 ? '+' : '-';\n var absOffset = Math.abs(offset);\n var hours = exports.zeroPad(parseInt('' + absOffset, 10));\n var minutes = exports.zeroPad(absOffset % 1 * 60);\n return \"\".concat(sign).concat(hours).concat(delimiter).concat(minutes);\n };\n });\n fns.isLeapYear;\n fns.isDate;\n fns.isArray;\n fns.isObject;\n fns.isBoolean;\n fns.zeroPad;\n fns.titleCase;\n fns.ordinal;\n fns.toCardinal;\n fns.normalize;\n fns.getEpoch;\n fns.beADate;\n fns.formatTimezone;\n\n var isLeapYear$2 = fns.isLeapYear; //given a month, return whether day number exists in it\n\n var hasDate = function hasDate(obj) {\n //invalid values\n if (monthLengths_1.hasOwnProperty(obj.month) !== true) {\n return false;\n } //support leap-year in february\n\n\n if (obj.month === 1) {\n if (isLeapYear$2(obj.year) && obj.date <= 29) {\n return true;\n } else {\n return obj.date <= 28;\n }\n } //is this date too-big for this month?\n\n\n var max = monthLengths_1[obj.month] || 0;\n\n if (obj.date <= max) {\n return true;\n }\n\n return false;\n };\n\n var hasDate_1 = hasDate;\n\n var months = months$1.mapping();\n\n var parseYear = function parseYear() {\n var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var today = arguments.length > 1 ? arguments[1] : undefined;\n var year = parseInt(str.trim(), 10); // use a given year from options.today\n\n if (!year && today) {\n year = today.year;\n } // fallback to this year\n\n\n year = year || new Date().getFullYear();\n return year;\n };\n\n var strFmt = [//iso-this 1998-05-30T22:00:00:000Z, iso-that 2017-04-03T08:00:00-0700\n {\n reg: /^(\\-?0?0?[0-9]{3,4})-([0-9]{1,2})-([0-9]{1,2})[T| ]([0-9.:]+)(Z|[0-9\\-\\+:]+)?$/i,\n parse: function parse(s, arr, givenTz, options) {\n var month = parseInt(arr[2], 10) - 1;\n var obj = {\n year: arr[1],\n month: month,\n date: arr[3]\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n parseOffset_1(s, arr[5]);\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, //iso \"2015-03-25\" or \"2015/03/25\" or \"2015/03/25 12:26:14 PM\"\n {\n reg: /^([0-9]{4})[\\-\\/.]([0-9]{1,2})[\\-\\/.]([0-9]{1,2}),?( [0-9]{1,2}:[0-9]{2}:?[0-9]{0,2}? ?(am|pm|gmt))?$/i,\n parse: function parse(s, arr) {\n var obj = {\n year: arr[1],\n month: parseInt(arr[2], 10) - 1,\n date: parseInt(arr[3], 10)\n };\n\n if (obj.month >= 12) {\n //support yyyy/dd/mm (weird, but ok)\n obj.date = parseInt(arr[2], 10);\n obj.month = parseInt(arr[3], 10) - 1;\n }\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, //mm/dd/yyyy - uk/canada \"6/28/2019, 12:26:14 PM\"\n {\n reg: /^([0-9]{1,2})[\\-\\/.]([0-9]{1,2})[\\-\\/.]?([0-9]{4})?,?( [0-9]{1,2}:[0-9]{2}:?[0-9]{0,2}? ?(am|pm|gmt))?$/i,\n parse: function parse(s, arr) {\n var month = parseInt(arr[1], 10) - 1;\n var date = parseInt(arr[2], 10); //support dd/mm/yyy\n\n if (s.british || month >= 12) {\n date = parseInt(arr[1], 10);\n month = parseInt(arr[2], 10) - 1;\n }\n\n var year = parseYear(arr[3], s._today) || new Date().getFullYear();\n var obj = {\n year: year,\n month: month,\n date: date\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, // '2012-06' last attempt at iso-like format\n {\n reg: /^([0-9]{4})[\\-\\/]([0-9]{2})$/i,\n parse: function parse(s, arr, givenTz, options) {\n var month = parseInt(arr[2], 10) - 1;\n var obj = {\n year: arr[1],\n month: month,\n date: 1\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n parseOffset_1(s, arr[5]);\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, //common british format - \"25-feb-2015\"\n {\n reg: /^([0-9]{1,2})[\\-\\/]([a-z]+)[\\-\\/]?([0-9]{4})?$/i,\n parse: function parse(s, arr) {\n var month = months[arr[2].toLowerCase()];\n var year = parseYear(arr[3], s._today);\n var obj = {\n year: year,\n month: month,\n date: fns.toCardinal(arr[1] || '')\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, //alt short format - \"feb-25-2015\"\n {\n reg: /^([a-z]+)[\\-\\/]([0-9]{1,2})[\\-\\/]?([0-9]{4})?$/i,\n parse: function parse(s, arr) {\n var month = months[arr[1].toLowerCase()];\n var year = parseYear(arr[3], s._today);\n var obj = {\n year: year,\n month: month,\n date: fns.toCardinal(arr[2] || '')\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, //Long \"Mar 25 2015\"\n //February 22, 2017 15:30:00\n {\n reg: /^([a-z]+) ([0-9]{1,2}(?:st|nd|rd|th)?),?( [0-9]{4})?( ([0-9:]+( ?am| ?pm| ?gmt)?))?$/i,\n parse: function parse(s, arr) {\n var month = months[arr[1].toLowerCase()];\n var year = parseYear(arr[3], s._today);\n var obj = {\n year: year,\n month: month,\n date: fns.toCardinal(arr[2] || '')\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, //February 2017 (implied date)\n {\n reg: /^([a-z]+) ([0-9]{4})$/i,\n parse: function parse(s, arr) {\n var month = months[arr[1].toLowerCase()];\n var year = parseYear(arr[2], s._today);\n var obj = {\n year: year,\n month: month,\n date: s._today.date || 1\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, //Long \"25 Mar 2015\"\n {\n reg: /^([0-9]{1,2}(?:st|nd|rd|th)?) ([a-z]+),?( [0-9]{4})?,? ?([0-9]{1,2}:[0-9]{2}:?[0-9]{0,2}? ?(am|pm|gmt))?$/i,\n parse: function parse(s, arr) {\n var month = months[arr[2].toLowerCase()];\n\n if (!month) {\n return null;\n }\n\n var year = parseYear(arr[3], s._today);\n var obj = {\n year: year,\n month: month,\n date: fns.toCardinal(arr[1])\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s, arr[4]);\n return s;\n }\n }, {\n // 'q2 2002'\n reg: /^(q[0-9])( of)?( [0-9]{4})?/i,\n parse: function parse(s, arr) {\n var quarter = arr[1] || '';\n s = s.quarter(quarter);\n var year = arr[3] || '';\n\n if (year) {\n year = year.trim();\n s = s.year(year);\n }\n\n return s;\n }\n }, {\n // 'summer 2002'\n reg: /^(spring|summer|winter|fall|autumn)( of)?( [0-9]{4})?/i,\n parse: function parse(s, arr) {\n var season = arr[1] || '';\n s = s.season(season);\n var year = arr[3] || '';\n\n if (year) {\n year = year.trim();\n s = s.year(year);\n }\n\n return s;\n }\n }, {\n // '200bc'\n reg: /^[0-9,]+ ?b\\.?c\\.?$/i,\n parse: function parse(s, arr) {\n var str = arr[0] || ''; //make negative-year\n\n str = str.replace(/^([0-9,]+) ?b\\.?c\\.?$/i, '-$1'); //remove commas\n\n str = str.replace(/,/g, '');\n var year = parseInt(str.trim(), 10);\n var d = new Date();\n var obj = {\n year: year,\n month: d.getMonth(),\n date: d.getDate()\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s);\n return s;\n }\n }, {\n // '200ad'\n reg: /^[0-9,]+ ?(a\\.?d\\.?|c\\.?e\\.?)$/i,\n parse: function parse(s, arr) {\n var str = arr[0] || ''; //remove commas\n\n str = str.replace(/,/g, '');\n var year = parseInt(str.trim(), 10);\n var d = new Date();\n var obj = {\n year: year,\n month: d.getMonth(),\n date: d.getDate()\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s);\n return s;\n }\n }, {\n // '1992'\n reg: /^[0-9]{4}( ?a\\.?d\\.?)?$/i,\n parse: function parse(s, arr) {\n var today = s._today;\n var year = parseYear(arr[0], today);\n var d = new Date(); // using today's date, but a new month is awkward.\n\n if (today.month && !today.date) {\n today.date = 1;\n }\n\n var obj = {\n year: year,\n month: today.month || d.getMonth(),\n date: today.date || d.getDate()\n };\n\n if (hasDate_1(obj) === false) {\n s.epoch = null;\n return s;\n }\n\n walk_1(s, obj);\n s = parseTime_1(s);\n return s;\n }\n }];\n var strParse = strFmt;\n\n // pull in 'today' data for the baseline moment\n var getNow = function getNow(s) {\n s.epoch = Date.now();\n Object.keys(s._today || {}).forEach(function (k) {\n if (typeof s[k] === 'function') {\n s = s[k](s._today[k]);\n }\n });\n return s;\n };\n\n var dates = {\n now: function now(s) {\n return getNow(s);\n },\n today: function today(s) {\n return getNow(s);\n },\n tonight: function tonight(s) {\n s = getNow(s);\n s = s.hour(18); //6pm\n\n return s;\n },\n tomorrow: function tomorrow(s) {\n s = getNow(s);\n s = s.add(1, 'day');\n s = s.startOf('day');\n return s;\n },\n yesterday: function yesterday(s) {\n s = getNow(s);\n s = s.subtract(1, 'day');\n s = s.startOf('day');\n return s;\n },\n christmas: function christmas(s) {\n var year = getNow(s).year();\n s = s.set([year, 11, 25, 18, 0, 0]); // Dec 25\n\n return s;\n },\n 'new years': function newYears(s) {\n var year = getNow(s).year();\n s = s.set([year, 11, 31, 18, 0, 0]); // Dec 31\n\n return s;\n }\n };\n dates['new years eve'] = dates['new years'];\n var namedDates = dates;\n\n // - can't use built-in js parser ;(\n //=========================================\n // ISO Date\t \"2015-03-25\"\n // Short Date\t\"03/25/2015\" or \"2015/03/25\"\n // Long Date\t\"Mar 25 2015\" or \"25 Mar 2015\"\n // Full Date\t\"Wednesday March 25 2015\"\n //=========================================\n //-- also -\n // if the given epoch is really small, they've probably given seconds and not milliseconds\n // anything below this number is likely (but not necessarily) a mistaken input.\n // this may seem like an arbitrary number, but it's 'within jan 1970'\n // this is only really ambiguous until 2054 or so\n\n var minimumEpoch = 2500000000;\n var defaults = {\n year: new Date().getFullYear(),\n month: 0,\n date: 1\n }; //support [2016, 03, 01] format\n\n var handleArray = function handleArray(s, arr, today) {\n if (arr.length === 0) {\n return s;\n }\n\n var order = ['year', 'month', 'date', 'hour', 'minute', 'second', 'millisecond'];\n\n for (var i = 0; i < order.length; i++) {\n var num = arr[i] || today[order[i]] || defaults[order[i]] || 0;\n s = s[order[i]](num);\n }\n\n return s;\n }; //support {year:2016, month:3} format\n\n\n var handleObject = function handleObject(s, obj, today) {\n // if obj is empty, do nothing\n if (Object.keys(obj).length === 0) {\n return s;\n }\n\n obj = Object.assign({}, defaults, today, obj);\n var keys = Object.keys(obj);\n\n for (var i = 0; i < keys.length; i++) {\n var unit = keys[i]; //make sure we have this method\n\n if (s[unit] === undefined || typeof s[unit] !== 'function') {\n continue;\n } //make sure the value is a number\n\n\n if (obj[unit] === null || obj[unit] === undefined || obj[unit] === '') {\n continue;\n }\n\n var num = obj[unit] || today[unit] || defaults[unit] || 0;\n s = s[unit](num);\n }\n\n return s;\n }; //find the epoch from different input styles\n\n\n var parseInput = function parseInput(s, input, givenTz) {\n var today = s._today || defaults; //if we've been given a epoch number, it's easy\n\n if (typeof input === 'number') {\n if (input > 0 && input < minimumEpoch && s.silent === false) {\n console.warn(' - Warning: You are setting the date to January 1970.');\n console.warn(' - did input seconds instead of milliseconds?');\n }\n\n s.epoch = input;\n return s;\n } //set tmp time\n\n\n s.epoch = Date.now(); // overwrite tmp time with 'today' value, if exists\n\n if (s._today && fns.isObject(s._today) && Object.keys(s._today).length > 0) {\n var res = handleObject(s, today, defaults);\n\n if (res.isValid()) {\n s.epoch = res.epoch;\n }\n } // null input means 'now'\n\n\n if (input === null || input === undefined || input === '') {\n return s; //k, we're good.\n } //support input of Date() object\n\n\n if (fns.isDate(input) === true) {\n s.epoch = input.getTime();\n return s;\n } //support [2016, 03, 01] format\n\n\n if (fns.isArray(input) === true) {\n s = handleArray(s, input, today);\n return s;\n } //support {year:2016, month:3} format\n\n\n if (fns.isObject(input) === true) {\n //support spacetime object as input\n if (input.epoch) {\n s.epoch = input.epoch;\n s.tz = input.tz;\n return s;\n }\n\n s = handleObject(s, input, today);\n return s;\n } //input as a string..\n\n\n if (typeof input !== 'string') {\n return s;\n } //little cleanup..\n\n\n input = input.replace(/\\b(mon|tues|wed|wednes|thu|thurs|fri|sat|satur|sun)(day)?\\b/i, '');\n input = input.replace(/,/g, '');\n input = input.replace(/ +/g, ' ').trim(); //try some known-words, like 'now'\n\n if (namedDates.hasOwnProperty(input) === true) {\n s = namedDates[input](s);\n return s;\n } //try each text-parse template, use the first good result\n\n\n for (var i = 0; i < strParse.length; i++) {\n var m = input.match(strParse[i].reg);\n\n if (m) {\n // console.log(strFmt[i].reg)\n var _res = strParse[i].parse(s, m, givenTz);\n\n if (_res !== null && _res.isValid()) {\n return _res;\n }\n }\n }\n\n if (s.silent === false) {\n console.warn(\"Warning: couldn't parse date-string: '\" + input + \"'\");\n }\n\n s.epoch = null;\n return s;\n };\n\n var input = parseInput;\n\n var shortDays = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];\n var longDays = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];\n var days = {\n \"short\": function short() {\n return shortDays;\n },\n \"long\": function long() {\n return longDays;\n },\n set: function set(i18n) {\n shortDays = i18n[\"short\"] || shortDays;\n longDays = i18n[\"long\"] || longDays;\n },\n aliases: {\n mo: 1,\n tu: 2,\n we: 3,\n th: 4,\n fr: 5,\n sa: 6,\n su: 7,\n tues: 2,\n weds: 3,\n wedn: 3,\n thur: 4,\n thurs: 4\n }\n };\n\n var titleCaseEnabled = true;\n var caseFormat = {\n useTitleCase: function useTitleCase() {\n return titleCaseEnabled;\n },\n set: function set(useTitleCase) {\n titleCaseEnabled = useTitleCase;\n }\n };\n\n // it's kind of nuts how involved this is\n // \"+01:00\", \"+0100\", or simply \"+01\"\n\n var isoOffset = function isoOffset(s) {\n var offset = s.timezone().current.offset;\n return !offset ? 'Z' : fns.formatTimezone(offset, ':');\n };\n\n var _offset = isoOffset;\n\n var applyCaseFormat = function applyCaseFormat(str) {\n if (caseFormat.useTitleCase()) {\n return fns.titleCase(str);\n }\n\n return str;\n };\n\n var format = {\n day: function day(s) {\n return applyCaseFormat(s.dayName());\n },\n 'day-short': function dayShort(s) {\n return applyCaseFormat(days[\"short\"]()[s.day()]);\n },\n 'day-number': function dayNumber(s) {\n return s.day();\n },\n 'day-ordinal': function dayOrdinal(s) {\n return fns.ordinal(s.day());\n },\n 'day-pad': function dayPad(s) {\n return fns.zeroPad(s.day());\n },\n date: function date(s) {\n return s.date();\n },\n 'date-ordinal': function dateOrdinal(s) {\n return fns.ordinal(s.date());\n },\n 'date-pad': function datePad(s) {\n return fns.zeroPad(s.date());\n },\n month: function month(s) {\n return applyCaseFormat(s.monthName());\n },\n 'month-short': function monthShort(s) {\n return applyCaseFormat(months$1[\"short\"]()[s.month()]);\n },\n 'month-number': function monthNumber(s) {\n return s.month();\n },\n 'month-ordinal': function monthOrdinal(s) {\n return fns.ordinal(s.month());\n },\n 'month-pad': function monthPad(s) {\n return fns.zeroPad(s.month());\n },\n 'iso-month': function isoMonth(s) {\n return fns.zeroPad(s.month() + 1);\n },\n //1-based months\n year: function year(s) {\n var year = s.year();\n\n if (year > 0) {\n return year;\n }\n\n year = Math.abs(year);\n return year + ' BC';\n },\n 'year-short': function yearShort(s) {\n var year = s.year();\n\n if (year > 0) {\n return \"'\".concat(String(s.year()).substr(2, 4));\n }\n\n year = Math.abs(year);\n return year + ' BC';\n },\n 'iso-year': function isoYear(s) {\n var year = s.year();\n var isNegative = year < 0;\n var str = fns.zeroPad(Math.abs(year), 4); //0-padded\n\n if (isNegative) {\n //negative years are for some reason 6-digits ('-00008')\n str = fns.zeroPad(str, 6);\n str = '-' + str;\n }\n\n return str;\n },\n time: function time(s) {\n return s.time();\n },\n 'time-24': function time24(s) {\n return \"\".concat(s.hour24(), \":\").concat(fns.zeroPad(s.minute()));\n },\n hour: function hour(s) {\n return s.hour12();\n },\n 'hour-pad': function hourPad(s) {\n return fns.zeroPad(s.hour12());\n },\n 'hour-24': function hour24(s) {\n return s.hour24();\n },\n 'hour-24-pad': function hour24Pad(s) {\n return fns.zeroPad(s.hour24());\n },\n minute: function minute(s) {\n return s.minute();\n },\n 'minute-pad': function minutePad(s) {\n return fns.zeroPad(s.minute());\n },\n second: function second(s) {\n return s.second();\n },\n 'second-pad': function secondPad(s) {\n return fns.zeroPad(s.second());\n },\n ampm: function ampm(s) {\n return s.ampm();\n },\n quarter: function quarter(s) {\n return 'Q' + s.quarter();\n },\n season: function season(s) {\n return s.season();\n },\n era: function era(s) {\n return s.era();\n },\n json: function json(s) {\n return s.json();\n },\n timezone: function timezone(s) {\n return s.timezone().name;\n },\n offset: function offset(s) {\n return _offset(s);\n },\n numeric: function numeric(s) {\n return \"\".concat(s.year(), \"/\").concat(fns.zeroPad(s.month() + 1), \"/\").concat(fns.zeroPad(s.date()));\n },\n // yyyy/mm/dd\n 'numeric-us': function numericUs(s) {\n return \"\".concat(fns.zeroPad(s.month() + 1), \"/\").concat(fns.zeroPad(s.date()), \"/\").concat(s.year());\n },\n // mm/dd/yyyy\n 'numeric-uk': function numericUk(s) {\n return \"\".concat(fns.zeroPad(s.date()), \"/\").concat(fns.zeroPad(s.month() + 1), \"/\").concat(s.year());\n },\n //dd/mm/yyyy\n 'mm/dd': function mmDd(s) {\n return \"\".concat(fns.zeroPad(s.month() + 1), \"/\").concat(fns.zeroPad(s.date()));\n },\n //mm/dd\n // ... https://en.wikipedia.org/wiki/ISO_8601 ;(((\n iso: function iso(s) {\n var year = s.format('iso-year');\n var month = fns.zeroPad(s.month() + 1); //1-based months\n\n var date = fns.zeroPad(s.date());\n var hour = fns.zeroPad(s.h24());\n var minute = fns.zeroPad(s.minute());\n var second = fns.zeroPad(s.second());\n var ms = fns.zeroPad(s.millisecond(), 3);\n var offset = _offset(s);\n return \"\".concat(year, \"-\").concat(month, \"-\").concat(date, \"T\").concat(hour, \":\").concat(minute, \":\").concat(second, \".\").concat(ms).concat(offset); //2018-03-09T08:50:00.000-05:00\n },\n 'iso-short': function isoShort(s) {\n var month = fns.zeroPad(s.month() + 1); //1-based months\n\n var date = fns.zeroPad(s.date());\n return \"\".concat(s.year(), \"-\").concat(month, \"-\").concat(date); //2017-02-15\n },\n 'iso-utc': function isoUtc(s) {\n return new Date(s.epoch).toISOString(); //2017-03-08T19:45:28.367Z\n },\n //i made these up\n nice: function nice(s) {\n return \"\".concat(months$1[\"short\"]()[s.month()], \" \").concat(fns.ordinal(s.date()), \", \").concat(s.time());\n },\n 'nice-24': function nice24(s) {\n return \"\".concat(months$1[\"short\"]()[s.month()], \" \").concat(fns.ordinal(s.date()), \", \").concat(s.hour24(), \":\").concat(fns.zeroPad(s.minute()));\n },\n 'nice-year': function niceYear(s) {\n return \"\".concat(months$1[\"short\"]()[s.month()], \" \").concat(fns.ordinal(s.date()), \", \").concat(s.year());\n },\n 'nice-day': function niceDay(s) {\n return \"\".concat(days[\"short\"]()[s.day()], \" \").concat(applyCaseFormat(months$1[\"short\"]()[s.month()]), \" \").concat(fns.ordinal(s.date()));\n },\n 'nice-full': function niceFull(s) {\n return \"\".concat(s.dayName(), \" \").concat(applyCaseFormat(s.monthName()), \" \").concat(fns.ordinal(s.date()), \", \").concat(s.time());\n },\n 'nice-full-24': function niceFull24(s) {\n return \"\".concat(s.dayName(), \" \").concat(applyCaseFormat(s.monthName()), \" \").concat(fns.ordinal(s.date()), \", \").concat(s.hour24(), \":\").concat(fns.zeroPad(s.minute()));\n }\n }; //aliases\n\n var aliases = {\n 'day-name': 'day',\n 'month-name': 'month',\n 'iso 8601': 'iso',\n 'time-h24': 'time-24',\n 'time-12': 'time',\n 'time-h12': 'time',\n tz: 'timezone',\n 'day-num': 'day-number',\n 'month-num': 'month-number',\n 'month-iso': 'iso-month',\n 'year-iso': 'iso-year',\n 'nice-short': 'nice',\n 'nice-short-24': 'nice-24',\n mdy: 'numeric-us',\n dmy: 'numeric-uk',\n ymd: 'numeric',\n 'yyyy/mm/dd': 'numeric',\n 'mm/dd/yyyy': 'numeric-us',\n 'dd/mm/yyyy': 'numeric-us',\n 'little-endian': 'numeric-uk',\n 'big-endian': 'numeric',\n 'day-nice': 'nice-day'\n };\n Object.keys(aliases).forEach(function (k) {\n return format[k] = format[aliases[k]];\n });\n\n var printFormat = function printFormat(s) {\n var str = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n\n //don't print anything if it's an invalid date\n if (s.isValid() !== true) {\n return '';\n } //support .format('month')\n\n\n if (format.hasOwnProperty(str)) {\n var out = format[str](s) || '';\n\n if (str !== 'json') {\n out = String(out);\n\n if (str !== 'ampm') {\n out = applyCaseFormat(out);\n }\n }\n\n return out;\n } //support '{hour}:{minute}' notation\n\n\n if (str.indexOf('{') !== -1) {\n var sections = /\\{(.+?)\\}/g;\n str = str.replace(sections, function (_, fmt) {\n fmt = fmt.toLowerCase().trim();\n\n if (format.hasOwnProperty(fmt)) {\n var _out = String(format[fmt](s));\n\n if (fmt !== 'ampm') {\n return applyCaseFormat(_out);\n }\n\n return _out;\n }\n\n return '';\n });\n return str;\n }\n\n return s.format('iso-short');\n };\n\n var format_1 = printFormat;\n\n var pad = fns.zeroPad;\n var formatTimezone = fns.formatTimezone; //parse this insane unix-time-templating thing, from the 19th century\n //http://unicode.org/reports/tr35/tr35-25.html#Date_Format_Patterns\n //time-symbols we support\n\n var mapping = {\n G: function G(s) {\n return s.era();\n },\n GG: function GG(s) {\n return s.era();\n },\n GGG: function GGG(s) {\n return s.era();\n },\n GGGG: function GGGG(s) {\n return s.era() === 'AD' ? 'Anno Domini' : 'Before Christ';\n },\n //year\n y: function y(s) {\n return s.year();\n },\n yy: function yy(s) {\n //last two chars\n return parseInt(String(s.year()).substr(2, 4), 10);\n },\n yyy: function yyy(s) {\n return s.year();\n },\n yyyy: function yyyy(s) {\n return s.year();\n },\n yyyyy: function yyyyy(s) {\n return '0' + s.year();\n },\n // u: (s) => {},//extended non-gregorian years\n //quarter\n Q: function Q(s) {\n return s.quarter();\n },\n QQ: function QQ(s) {\n return s.quarter();\n },\n QQQ: function QQQ(s) {\n return s.quarter();\n },\n QQQQ: function QQQQ(s) {\n return s.quarter();\n },\n //month\n M: function M(s) {\n return s.month() + 1;\n },\n MM: function MM(s) {\n return pad(s.month() + 1);\n },\n MMM: function MMM(s) {\n return s.format('month-short');\n },\n MMMM: function MMMM(s) {\n return s.format('month');\n },\n //week\n w: function w(s) {\n return s.week();\n },\n ww: function ww(s) {\n return pad(s.week());\n },\n //week of month\n // W: (s) => s.week(),\n //date of month\n d: function d(s) {\n return s.date();\n },\n dd: function dd(s) {\n return pad(s.date());\n },\n //date of year\n D: function D(s) {\n return s.dayOfYear();\n },\n DD: function DD(s) {\n return pad(s.dayOfYear());\n },\n DDD: function DDD(s) {\n return pad(s.dayOfYear(), 3);\n },\n // F: (s) => {},//date of week in month\n // g: (s) => {},//modified julian day\n //day\n E: function E(s) {\n return s.format('day-short');\n },\n EE: function EE(s) {\n return s.format('day-short');\n },\n EEE: function EEE(s) {\n return s.format('day-short');\n },\n EEEE: function EEEE(s) {\n return s.format('day');\n },\n EEEEE: function EEEEE(s) {\n return s.format('day')[0];\n },\n e: function e(s) {\n return s.day();\n },\n ee: function ee(s) {\n return s.day();\n },\n eee: function eee(s) {\n return s.format('day-short');\n },\n eeee: function eeee(s) {\n return s.format('day');\n },\n eeeee: function eeeee(s) {\n return s.format('day')[0];\n },\n //am/pm\n a: function a(s) {\n return s.ampm().toUpperCase();\n },\n aa: function aa(s) {\n return s.ampm().toUpperCase();\n },\n aaa: function aaa(s) {\n return s.ampm().toUpperCase();\n },\n aaaa: function aaaa(s) {\n return s.ampm().toUpperCase();\n },\n //hour\n h: function h(s) {\n return s.h12();\n },\n hh: function hh(s) {\n return pad(s.h12());\n },\n H: function H(s) {\n return s.hour();\n },\n HH: function HH(s) {\n return pad(s.hour());\n },\n // j: (s) => {},//weird hour format\n m: function m(s) {\n return s.minute();\n },\n mm: function mm(s) {\n return pad(s.minute());\n },\n s: function s(_s) {\n return _s.second();\n },\n ss: function ss(s) {\n return pad(s.second());\n },\n //milliseconds in the day\n A: function A(s) {\n return s.epoch - s.startOf('day').epoch;\n },\n //timezone\n z: function z(s) {\n return s.timezone().name;\n },\n zz: function zz(s) {\n return s.timezone().name;\n },\n zzz: function zzz(s) {\n return s.timezone().name;\n },\n zzzz: function zzzz(s) {\n return s.timezone().name;\n },\n Z: function Z(s) {\n return formatTimezone(s.timezone().current.offset);\n },\n ZZ: function ZZ(s) {\n return formatTimezone(s.timezone().current.offset);\n },\n ZZZ: function ZZZ(s) {\n return formatTimezone(s.timezone().current.offset);\n },\n ZZZZ: function ZZZZ(s) {\n return formatTimezone(s.timezone().current.offset, ':');\n }\n };\n\n var addAlias = function addAlias(_char, to, n) {\n var name = _char;\n var toName = to;\n\n for (var i = 0; i < n; i += 1) {\n mapping[name] = mapping[toName];\n name += _char;\n toName += to;\n }\n };\n\n addAlias('q', 'Q', 4);\n addAlias('L', 'M', 4);\n addAlias('Y', 'y', 4);\n addAlias('c', 'e', 4);\n addAlias('k', 'H', 2);\n addAlias('K', 'h', 2);\n addAlias('S', 's', 2);\n addAlias('v', 'z', 4);\n addAlias('V', 'Z', 4); // support unix-style escaping with ' character\n\n var escapeChars = function escapeChars(arr) {\n for (var i = 0; i < arr.length; i += 1) {\n if (arr[i] === \"'\") {\n // greedy-search for next apostrophe\n for (var o = i + 1; o < arr.length; o += 1) {\n if (arr[o]) {\n arr[i] += arr[o];\n }\n\n if (arr[o] === \"'\") {\n arr[o] = null;\n break;\n }\n\n arr[o] = null;\n }\n }\n }\n\n return arr.filter(function (ch) {\n return ch;\n });\n }; //combine consecutive chars, like 'yyyy' as one.\n\n\n var combineRepeated = function combineRepeated(arr) {\n for (var i = 0; i < arr.length; i += 1) {\n var c = arr[i]; // greedy-forward\n\n for (var o = i + 1; o < arr.length; o += 1) {\n if (arr[o] === c) {\n arr[i] += arr[o];\n arr[o] = null;\n } else {\n break;\n }\n }\n } // '' means one apostrophe\n\n\n arr = arr.filter(function (ch) {\n return ch;\n });\n arr = arr.map(function (str) {\n if (str === \"''\") {\n str = \"'\";\n }\n\n return str;\n });\n return arr;\n };\n\n var unixFmt = function unixFmt(s, str) {\n var arr = str.split(''); // support character escaping\n\n arr = escapeChars(arr); //combine 'yyyy' as string.\n\n arr = combineRepeated(arr);\n return arr.reduce(function (txt, c) {\n if (mapping[c] !== undefined) {\n txt += mapping[c](s) || '';\n } else {\n // 'unescape'\n if (/^'.{1,}'$/.test(c)) {\n c = c.replace(/'/g, '');\n }\n\n txt += c;\n }\n\n return txt;\n }, '');\n };\n\n var unixFmt_1 = unixFmt;\n\n var units$2 = ['year', 'season', 'quarter', 'month', 'week', 'day', 'quarterHour', 'hour', 'minute'];\n\n var doUnit = function doUnit(s, k) {\n var start = s.clone().startOf(k);\n var end = s.clone().endOf(k);\n var duration = end.epoch - start.epoch;\n var percent = (s.epoch - start.epoch) / duration;\n return parseFloat(percent.toFixed(2));\n }; //how far it is along, from 0-1\n\n\n var progress = function progress(s, unit) {\n if (unit) {\n unit = fns.normalize(unit);\n return doUnit(s, unit);\n }\n\n var obj = {};\n units$2.forEach(function (k) {\n obj[k] = doUnit(s, k);\n });\n return obj;\n };\n\n var progress_1 = progress;\n\n var nearest = function nearest(s, unit) {\n //how far have we gone?\n var prog = s.progress();\n unit = fns.normalize(unit); //fix camel-case for this one\n\n if (unit === 'quarterhour') {\n unit = 'quarterHour';\n }\n\n if (prog[unit] !== undefined) {\n // go forward one?\n if (prog[unit] > 0.5) {\n s = s.add(1, unit);\n } // go to start\n\n\n s = s.startOf(unit);\n } else if (s.silent === false) {\n console.warn(\"no known unit '\" + unit + \"'\");\n }\n\n return s;\n };\n\n var nearest_1 = nearest;\n\n //increment until dates are the same\n var climb = function climb(a, b, unit) {\n var i = 0;\n a = a.clone();\n\n while (a.isBefore(b)) {\n //do proper, expensive increment to catch all-the-tricks\n a = a.add(1, unit);\n i += 1;\n } //oops, we went too-far..\n\n\n if (a.isAfter(b, unit)) {\n i -= 1;\n }\n\n return i;\n }; // do a thurough +=1 on the unit, until they match\n // for speed-reasons, only used on day, month, week.\n\n\n var diffOne = function diffOne(a, b, unit) {\n if (a.isBefore(b)) {\n return climb(a, b, unit);\n } else {\n return climb(b, a, unit) * -1; //reverse it\n }\n };\n\n var one = diffOne;\n\n // 2020 - 2019 may be 1 year, or 0 years\n // - '1 year difference' means 366 days during a leap year\n\n var fastYear = function fastYear(a, b) {\n var years = b.year() - a.year(); // should we decrement it by 1?\n\n a = a.year(b.year());\n\n if (a.isAfter(b)) {\n years -= 1;\n }\n\n return years;\n }; // use a waterfall-method for computing a diff of any 'pre-knowable' units\n // compute years, then compute months, etc..\n // ... then ms-math for any very-small units\n\n\n var diff$1 = function diff(a, b) {\n // an hour is always the same # of milliseconds\n // so these units can be 'pre-calculated'\n var msDiff = b.epoch - a.epoch;\n var obj = {\n milliseconds: msDiff,\n seconds: parseInt(msDiff / 1000, 10)\n };\n obj.minutes = parseInt(obj.seconds / 60, 10);\n obj.hours = parseInt(obj.minutes / 60, 10); //do the year\n\n var tmp = a.clone();\n obj.years = fastYear(tmp, b);\n tmp = a.add(obj.years, 'year'); //there's always 12 months in a year...\n\n obj.months = obj.years * 12;\n tmp = a.add(obj.months, 'month');\n obj.months += one(tmp, b, 'month'); // there's always atleast 52 weeks in a year..\n // (month * 4) isn't as close\n\n obj.weeks = obj.years * 52;\n tmp = a.add(obj.weeks, 'week');\n obj.weeks += one(tmp, b, 'week'); // there's always atleast 7 days in a week\n\n obj.days = obj.weeks * 7;\n tmp = a.add(obj.days, 'day');\n obj.days += one(tmp, b, 'day');\n return obj;\n };\n\n var waterfall = diff$1;\n\n var reverseDiff = function reverseDiff(obj) {\n Object.keys(obj).forEach(function (k) {\n obj[k] *= -1;\n });\n return obj;\n }; // this method counts a total # of each unit, between a, b.\n // '1 month' means 28 days in february\n // '1 year' means 366 days in a leap year\n\n\n var main$1 = function main(a, b, unit) {\n b = fns.beADate(b, a); //reverse values, if necessary\n\n var reversed = false;\n\n if (a.isAfter(b)) {\n var tmp = a;\n a = b;\n b = tmp;\n reversed = true;\n } //compute them all (i know!)\n\n\n var obj = waterfall(a, b);\n\n if (reversed) {\n obj = reverseDiff(obj);\n } //return just the requested unit\n\n\n if (unit) {\n //make sure it's plural-form\n unit = fns.normalize(unit);\n\n if (/s$/.test(unit) !== true) {\n unit += 's';\n }\n\n if (unit === 'dates') {\n unit = 'days';\n }\n\n return obj[unit];\n }\n\n return obj;\n };\n\n var diff = main$1;\n\n //our conceptual 'break-points' for each unit\n\n var qualifiers = {\n months: {\n almost: 10,\n over: 4\n },\n days: {\n almost: 25,\n over: 10\n },\n hours: {\n almost: 20,\n over: 8\n },\n minutes: {\n almost: 50,\n over: 20\n },\n seconds: {\n almost: 50,\n over: 20\n }\n }; //get number of hours/minutes... between the two dates\n\n function getDiff(a, b) {\n var isBefore = a.isBefore(b);\n var later = isBefore ? b : a;\n var earlier = isBefore ? a : b;\n earlier = earlier.clone();\n var diff = {\n years: 0,\n months: 0,\n days: 0,\n hours: 0,\n minutes: 0,\n seconds: 0\n };\n Object.keys(diff).forEach(function (unit) {\n if (earlier.isSame(later, unit)) {\n return;\n }\n\n var max = earlier.diff(later, unit);\n earlier = earlier.add(max, unit);\n diff[unit] = max;\n }); //reverse it, if necessary\n\n if (isBefore) {\n Object.keys(diff).forEach(function (u) {\n if (diff[u] !== 0) {\n diff[u] *= -1;\n }\n });\n }\n\n return diff;\n } // Expects a plural unit arg\n\n\n function pluralize(value, unit) {\n if (value === 1) {\n unit = unit.slice(0, -1);\n }\n\n return value + ' ' + unit;\n } //create the human-readable diff between the two dates\n\n\n var since = function since(start, end) {\n end = fns.beADate(end, start);\n var diff = getDiff(start, end);\n var isNow = Object.keys(diff).every(function (u) {\n return !diff[u];\n });\n\n if (isNow === true) {\n return {\n diff: diff,\n rounded: 'now',\n qualified: 'now',\n precise: 'now'\n };\n }\n\n var rounded;\n var qualified;\n var precise;\n var englishValues = []; //go through each value and create its text-representation\n\n Object.keys(diff).forEach(function (unit, i, units) {\n var value = Math.abs(diff[unit]);\n\n if (value === 0) {\n return;\n }\n\n var englishValue = pluralize(value, unit);\n englishValues.push(englishValue);\n\n if (!rounded) {\n rounded = qualified = englishValue;\n\n if (i > 4) {\n return;\n } //is it a 'almost' something, etc?\n\n\n var nextUnit = units[i + 1];\n var nextValue = Math.abs(diff[nextUnit]);\n\n if (nextValue > qualifiers[nextUnit].almost) {\n rounded = pluralize(value + 1, unit);\n qualified = 'almost ' + rounded;\n } else if (nextValue > qualifiers[nextUnit].over) qualified = 'over ' + englishValue;\n }\n }); //make them into a string\n\n precise = englishValues.splice(0, 2).join(', '); //handle before/after logic\n\n if (start.isAfter(end) === true) {\n rounded += ' ago';\n qualified += ' ago';\n precise += ' ago';\n } else {\n rounded = 'in ' + rounded;\n qualified = 'in ' + qualified;\n precise = 'in ' + precise;\n }\n\n return {\n diff: diff,\n rounded: rounded,\n qualified: qualified,\n precise: precise\n };\n };\n\n var since_1 = since;\n\n //https://www.timeanddate.com/calendar/aboutseasons.html\n // Spring - from March 1 to May 31;\n // Summer - from June 1 to August 31;\n // Fall (autumn) - from September 1 to November 30; and,\n // Winter - from December 1 to February 28 (February 29 in a leap year).\n var seasons = {\n north: [['spring', 2, 1], //spring march 1\n ['summer', 5, 1], //june 1\n ['fall', 8, 1], //sept 1\n ['autumn', 8, 1], //sept 1\n ['winter', 11, 1] //dec 1\n ],\n south: [['fall', 2, 1], //march 1\n ['autumn', 2, 1], //march 1\n ['winter', 5, 1], //june 1\n ['spring', 8, 1], //sept 1\n ['summer', 11, 1] //dec 1\n ]\n };\n\n var quarters = [null, [0, 1], //jan 1\n [3, 1], //apr 1\n [6, 1], //july 1\n [9, 1] //oct 1\n ];\n\n var units$1 = {\n minute: function minute(s) {\n walk_1(s, {\n second: 0,\n millisecond: 0\n });\n return s;\n },\n quarterhour: function quarterhour(s) {\n var minute = s.minutes();\n\n if (minute >= 45) {\n s = s.minutes(45);\n } else if (minute >= 30) {\n s = s.minutes(30);\n } else if (minute >= 15) {\n s = s.minutes(15);\n } else {\n s = s.minutes(0);\n }\n\n walk_1(s, {\n second: 0,\n millisecond: 0\n });\n return s;\n },\n hour: function hour(s) {\n walk_1(s, {\n minute: 0,\n second: 0,\n millisecond: 0\n });\n return s;\n },\n day: function day(s) {\n walk_1(s, {\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n });\n return s;\n },\n week: function week(s) {\n var original = s.clone();\n s = s.day(s._weekStart); //monday\n\n if (s.isAfter(original)) {\n s = s.subtract(1, 'week');\n }\n\n walk_1(s, {\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n });\n return s;\n },\n month: function month(s) {\n walk_1(s, {\n date: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n });\n return s;\n },\n quarter: function quarter(s) {\n var q = s.quarter();\n\n if (quarters[q]) {\n walk_1(s, {\n month: quarters[q][0],\n date: quarters[q][1],\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n });\n }\n\n return s;\n },\n season: function season(s) {\n var current = s.season();\n var hem = 'north';\n\n if (s.hemisphere() === 'South') {\n hem = 'south';\n }\n\n for (var i = 0; i < seasons[hem].length; i++) {\n if (seasons[hem][i][0] === current) {\n //winter goes between years\n var year = s.year();\n\n if (current === 'winter' && s.month() < 3) {\n year -= 1;\n }\n\n walk_1(s, {\n year: year,\n month: seasons[hem][i][1],\n date: seasons[hem][i][2],\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n });\n return s;\n }\n }\n\n return s;\n },\n year: function year(s) {\n walk_1(s, {\n month: 0,\n date: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0\n });\n return s;\n },\n decade: function decade(s) {\n s = s.startOf('year');\n var year = s.year();\n var decade = parseInt(year / 10, 10) * 10;\n s = s.year(decade);\n return s;\n },\n century: function century(s) {\n s = s.startOf('year');\n var year = s.year(); // near 0AD goes '-1 | +1'\n\n var decade = parseInt(year / 100, 10) * 100;\n s = s.year(decade);\n return s;\n }\n };\n units$1.date = units$1.day;\n\n var startOf = function startOf(a, unit) {\n var s = a.clone();\n unit = fns.normalize(unit);\n\n if (units$1[unit]) {\n return units$1[unit](s);\n }\n\n if (unit === 'summer' || unit === 'winter') {\n s = s.season(unit);\n return units$1.season(s);\n }\n\n return s;\n }; //piggy-backs off startOf\n\n\n var endOf = function endOf(a, unit) {\n var s = a.clone();\n unit = fns.normalize(unit);\n\n if (units$1[unit]) {\n // go to beginning, go to next one, step back 1ms\n s = units$1[unit](s); // startof\n\n s = s.add(1, unit);\n s = s.subtract(1, 'millisecond');\n return s;\n }\n\n return s;\n };\n\n var startOf_1 = {\n startOf: startOf,\n endOf: endOf\n };\n\n var isDay = function isDay(unit) {\n if (days[\"short\"]().find(function (s) {\n return s === unit;\n })) {\n return true;\n }\n\n if (days[\"long\"]().find(function (s) {\n return s === unit;\n })) {\n return true;\n }\n\n return false;\n }; // return a list of the weeks/months/days between a -> b\n // returns spacetime objects in the timezone of the input\n\n\n var every = function every(start) {\n var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var end = arguments.length > 2 ? arguments[2] : undefined;\n\n if (!unit || !end) {\n return [];\n } //cleanup unit param\n\n\n unit = fns.normalize(unit); //cleanup to param\n\n end = start.clone().set(end); //swap them, if they're backwards\n\n if (start.isAfter(end)) {\n var tmp = start;\n start = end;\n end = tmp;\n } //support 'every wednesday'\n\n\n var d = start.clone();\n\n if (isDay(unit)) {\n d = d.next(unit);\n unit = 'week';\n } else {\n d = d.next(unit);\n } //okay, actually start doing it\n\n\n var result = [];\n\n while (d.isBefore(end)) {\n result.push(d);\n d = d.add(1, unit);\n }\n\n return result;\n };\n\n var every_1 = every;\n\n var parseDst = function parseDst(dst) {\n if (!dst) {\n return [];\n }\n\n return dst.split('->');\n };\n\n var titleCase = function titleCase(str) {\n str = str[0].toUpperCase() + str.substr(1);\n str = str.replace(/\\/gmt/, '/GMT');\n str = str.replace(/[\\/_]([a-z])/gi, function (s) {\n return s.toUpperCase();\n });\n return str;\n }; //get metadata about this timezone\n\n\n var timezone = function timezone(s) {\n var zones = s.timezones;\n var tz = s.tz;\n\n if (zones.hasOwnProperty(tz) === false) {\n tz = find(s.tz, zones);\n }\n\n if (tz === null) {\n if (s.silent === false) {\n console.warn(\"Warn: could not find given or local timezone - '\" + s.tz + \"'\");\n }\n\n return {\n current: {\n epochShift: 0\n }\n };\n }\n\n var found = zones[tz];\n var result = {\n name: titleCase(tz),\n hasDst: Boolean(found.dst),\n default_offset: found.offset,\n //do north-hemisphere version as default (sorry!)\n hemisphere: found.hem === 's' ? 'South' : 'North',\n current: {}\n };\n\n if (result.hasDst) {\n var arr = parseDst(found.dst);\n result.change = {\n start: arr[0],\n back: arr[1]\n };\n } //find the offsets for summer/winter times\n //(these variable names are north-centric)\n\n\n var summer = found.offset; // (july)\n\n var winter = summer; // (january) assume it's the same for now\n\n if (result.hasDst === true) {\n if (result.hemisphere === 'North') {\n winter = summer - 1;\n } else {\n //southern hemisphere\n winter = found.offset + 1;\n }\n } //find out which offset to use right now\n //use 'summer' time july-time\n\n\n if (result.hasDst === false) {\n result.current.offset = summer;\n result.current.isDST = false;\n } else if (summerTime(s.epoch, result.change.start, result.change.back, summer, winter) === true) {\n result.current.offset = summer;\n result.current.isDST = result.hemisphere === 'North'; //dst 'on' in winter in north\n } else {\n //use 'winter' january-time\n result.current.offset = winter;\n result.current.isDST = result.hemisphere === 'South'; //dst 'on' in summer in south\n }\n\n return result;\n };\n\n var timezone_1 = timezone;\n\n var units = ['century', 'decade', 'year', 'month', 'date', 'day', 'hour', 'minute', 'second', 'millisecond']; //the spacetime instance methods (also, the API)\n\n var methods$4 = {\n set: function set(input$1, tz) {\n var s = this.clone();\n s = input(s, input$1, null);\n\n if (tz) {\n this.tz = find(tz);\n }\n\n return s;\n },\n timezone: function timezone() {\n return timezone_1(this);\n },\n isDST: function isDST() {\n return timezone_1(this).current.isDST;\n },\n hasDST: function hasDST() {\n return timezone_1(this).hasDst;\n },\n offset: function offset() {\n return timezone_1(this).current.offset * 60;\n },\n hemisphere: function hemisphere() {\n return timezone_1(this).hemisphere;\n },\n format: function format(fmt) {\n return format_1(this, fmt);\n },\n unixFmt: function unixFmt(fmt) {\n return unixFmt_1(this, fmt);\n },\n startOf: function startOf(unit) {\n return startOf_1.startOf(this, unit);\n },\n endOf: function endOf(unit) {\n return startOf_1.endOf(this, unit);\n },\n leapYear: function leapYear() {\n var year = this.year();\n return fns.isLeapYear(year);\n },\n progress: function progress(unit) {\n return progress_1(this, unit);\n },\n nearest: function nearest(unit) {\n return nearest_1(this, unit);\n },\n diff: function diff$1(d, unit) {\n return diff(this, d, unit);\n },\n since: function since(d) {\n if (!d) {\n d = this.clone().set();\n }\n\n return since_1(this, d);\n },\n next: function next(unit) {\n var s = this.add(1, unit);\n return s.startOf(unit);\n },\n //the start of the previous year/week/century\n last: function last(unit) {\n var s = this.subtract(1, unit);\n return s.startOf(unit);\n },\n isValid: function isValid() {\n //null/undefined epochs\n if (!this.epoch && this.epoch !== 0) {\n return false;\n }\n\n return !isNaN(this.d.getTime());\n },\n //travel to this timezone\n \"goto\": function goto(tz) {\n var s = this.clone();\n s.tz = find(tz, s.timezones); //science!\n\n return s;\n },\n //get each week/month/day between a -> b\n every: function every(unit, to) {\n // allow swapping these params:\n if (_typeof(unit) === 'object' && typeof to === 'string') {\n var tmp = to;\n to = unit;\n unit = tmp;\n }\n\n return every_1(this, unit, to);\n },\n isAwake: function isAwake() {\n var hour = this.hour(); //10pm -> 8am\n\n if (hour < 8 || hour > 22) {\n return false;\n }\n\n return true;\n },\n isAsleep: function isAsleep() {\n return !this.isAwake();\n },\n //pretty-printing\n log: function log() {\n console.log('');\n console.log(format_1(this, 'nice-short'));\n return this;\n },\n logYear: function logYear() {\n console.log('');\n console.log(format_1(this, 'full-short'));\n return this;\n },\n json: function json() {\n var _this = this;\n\n return units.reduce(function (h, unit) {\n h[unit] = _this[unit]();\n return h;\n }, {});\n },\n debug: function debug() {\n var tz = this.timezone();\n var date = this.format('MM') + ' ' + this.format('date-ordinal') + ' ' + this.year();\n date += '\\n - ' + this.format('time');\n console.log('\\n\\n', date + '\\n - ' + tz.name + ' (' + tz.current.offset + ')');\n return this;\n },\n //alias of 'since' but opposite - like moment.js\n from: function from(d) {\n d = this.clone().set(d);\n return d.since(this);\n },\n fromNow: function fromNow() {\n var d = this.clone().set(Date.now());\n return d.since(this);\n },\n weekStart: function weekStart(input) {\n //accept a number directly\n if (typeof input === 'number') {\n this._weekStart = input;\n return this;\n }\n\n if (typeof input === 'string') {\n // accept 'wednesday'\n input = input.toLowerCase().trim();\n var num = days[\"short\"]().indexOf(input);\n\n if (num === -1) {\n num = days[\"long\"]().indexOf(input);\n }\n\n if (num === -1) {\n num = 1; //go back to default\n }\n\n this._weekStart = num;\n } else {\n console.warn('Spacetime Error: Cannot understand .weekStart() input:', input);\n }\n\n return this;\n }\n }; // aliases\n\n methods$4.inDST = methods$4.isDST;\n methods$4.round = methods$4.nearest;\n methods$4.each = methods$4.every;\n var methods_1 = methods$4;\n\n //these methods wrap around them.\n\n var isLeapYear$1 = fns.isLeapYear;\n\n var validate = function validate(n) {\n //handle number as a string\n if (typeof n === 'string') {\n n = parseInt(n, 10);\n }\n\n return n;\n };\n\n var order$1 = ['year', 'month', 'date', 'hour', 'minute', 'second', 'millisecond']; //reduce hostile micro-changes when moving dates by millisecond\n\n var confirm = function confirm(s, tmp, unit) {\n var n = order$1.indexOf(unit);\n var arr = order$1.slice(n, order$1.length);\n\n for (var i = 0; i < arr.length; i++) {\n var want = tmp[arr[i]]();\n s[arr[i]](want);\n }\n\n return s;\n };\n\n var set = {\n milliseconds: function milliseconds(s, n) {\n n = validate(n);\n var current = s.millisecond();\n var diff = current - n; //milliseconds to shift by\n\n return s.epoch - diff;\n },\n seconds: function seconds(s, n) {\n n = validate(n);\n var diff = s.second() - n;\n var shift = diff * milliseconds.second;\n return s.epoch - shift;\n },\n minutes: function minutes(s, n) {\n n = validate(n);\n var old = s.clone();\n var diff = s.minute() - n;\n var shift = diff * milliseconds.minute;\n s.epoch -= shift; // check against a screw-up\n // if (old.hour() != s.hour()) {\n // walkTo(old, {\n // minute: n\n // })\n // return old.epoch\n // }\n\n confirm(s, old, 'second');\n return s.epoch;\n },\n hours: function hours(s, n) {\n n = validate(n);\n\n if (n >= 24) {\n n = 24;\n } else if (n < 0) {\n n = 0;\n }\n\n var old = s.clone();\n var diff = s.hour() - n;\n var shift = diff * milliseconds.hour;\n s.epoch -= shift; // oops, did we change the day?\n\n if (s.date() !== old.date()) {\n s = old.clone();\n\n if (diff > 1) {\n diff -= 1;\n }\n\n if (diff < 1) {\n diff += 1;\n }\n\n shift = diff * milliseconds.hour;\n s.epoch -= shift;\n }\n\n walk_1(s, {\n hour: n\n });\n confirm(s, old, 'minute');\n return s.epoch;\n },\n //support setting time by '4:25pm' - this isn't very-well developed..\n time: function time(s, str) {\n var m = str.match(/([0-9]{1,2})[:h]([0-9]{1,2})(:[0-9]{1,2})? ?(am|pm)?/);\n\n if (!m) {\n //fallback to support just '2am'\n m = str.match(/([0-9]{1,2}) ?(am|pm)/);\n\n if (!m) {\n return s.epoch;\n }\n\n m.splice(2, 0, '0'); //add implicit 0 minutes\n\n m.splice(3, 0, ''); //add implicit seconds\n }\n\n var h24 = false;\n var hour = parseInt(m[1], 10);\n var minute = parseInt(m[2], 10);\n\n if (hour > 12) {\n h24 = true;\n } //make the hour into proper 24h time\n\n\n if (h24 === false) {\n if (m[4] === 'am' && hour === 12) {\n //12am is midnight\n hour = 0;\n }\n\n if (m[4] === 'pm' && hour < 12) {\n //12pm is noon\n hour += 12;\n }\n } // handle seconds\n\n\n m[3] = m[3] || '';\n m[3] = m[3].replace(/:/, '');\n var sec = parseInt(m[3], 10) || 0;\n s = s.hour(hour);\n s = s.minute(minute);\n s = s.second(sec);\n s = s.millisecond(0);\n return s.epoch;\n },\n date: function date(s, n) {\n n = validate(n); //avoid setting february 31st\n\n if (n > 28) {\n var month = s.month();\n var max = monthLengths_1[month]; // support leap day in february\n\n if (month === 1 && n === 29 && isLeapYear$1(s.year())) {\n max = 29;\n }\n\n if (n > max) {\n n = max;\n }\n } //avoid setting < 0\n\n\n if (n <= 0) {\n n = 1;\n }\n\n walk_1(s, {\n date: n\n });\n return s.epoch;\n },\n //this one's tricky\n month: function month(s, n) {\n if (typeof n === 'string') {\n n = months$1.mapping()[n.toLowerCase()];\n }\n\n n = validate(n); //don't go past december\n\n if (n >= 12) {\n n = 11;\n }\n\n if (n <= 0) {\n n = 0;\n }\n\n var date = s.date(); //there's no 30th of february, etc.\n\n if (date > monthLengths_1[n]) {\n //make it as close as we can..\n date = monthLengths_1[n];\n }\n\n walk_1(s, {\n month: n,\n date: date\n });\n return s.epoch;\n },\n year: function year(s, n) {\n // support '97\n if (typeof n === 'string' && /^'[0-9]{2}$/.test(n)) {\n n = n.replace(/'/, '').trim();\n n = Number(n); // '89 is 1989\n\n if (n > 30) {\n //change this in 10y\n n = 1900 + n;\n } else {\n // '12 is 2012\n n = 2000 + n;\n }\n }\n\n n = validate(n);\n walk_1(s, {\n year: n\n });\n return s.epoch;\n },\n dayOfYear: function dayOfYear(s, n) {\n n = validate(n);\n var old = s.clone();\n n -= 1; //days are 1-based\n\n if (n <= 0) {\n n = 0;\n } else if (n >= 365) {\n n = 364;\n }\n\n s = s.startOf('year');\n s = s.add(n, 'day');\n confirm(s, old, 'hour');\n return s.epoch;\n }\n };\n\n var methods$3 = {\n millisecond: function millisecond(num) {\n if (num !== undefined) {\n var s = this.clone();\n s.epoch = set.milliseconds(s, num);\n return s;\n }\n\n return this.d.getMilliseconds();\n },\n second: function second(num) {\n if (num !== undefined) {\n var s = this.clone();\n s.epoch = set.seconds(s, num);\n return s;\n }\n\n return this.d.getSeconds();\n },\n minute: function minute(num) {\n if (num !== undefined) {\n var s = this.clone();\n s.epoch = set.minutes(s, num);\n return s;\n }\n\n return this.d.getMinutes();\n },\n hour: function hour(num) {\n var d = this.d;\n\n if (num !== undefined) {\n var s = this.clone();\n s.epoch = set.hours(s, num);\n return s;\n }\n\n return d.getHours();\n },\n //'3:30' is 3.5\n hourFloat: function hourFloat(num) {\n if (num !== undefined) {\n var s = this.clone();\n\n var _minute = num % 1;\n\n _minute = _minute * 60;\n\n var _hour = parseInt(num, 10);\n\n s.epoch = set.hours(s, _hour);\n s.epoch = set.minutes(s, _minute);\n return s;\n }\n\n var d = this.d;\n var hour = d.getHours();\n var minute = d.getMinutes();\n minute = minute / 60;\n return hour + minute;\n },\n // hour in 12h format\n hour12: function hour12(str) {\n var d = this.d;\n\n if (str !== undefined) {\n var s = this.clone();\n str = '' + str;\n var m = str.match(/^([0-9]+)(am|pm)$/);\n\n if (m) {\n var hour = parseInt(m[1], 10);\n\n if (m[2] === 'pm') {\n hour += 12;\n }\n\n s.epoch = set.hours(s, hour);\n }\n\n return s;\n } //get the hour\n\n\n var hour12 = d.getHours();\n\n if (hour12 > 12) {\n hour12 = hour12 - 12;\n }\n\n if (hour12 === 0) {\n hour12 = 12;\n }\n\n return hour12;\n },\n //some ambiguity here with 12/24h\n time: function time(str) {\n if (str !== undefined) {\n var s = this.clone();\n str = str.toLowerCase().trim();\n s.epoch = set.time(s, str);\n return s;\n }\n\n return \"\".concat(this.h12(), \":\").concat(fns.zeroPad(this.minute())).concat(this.ampm());\n },\n // either 'am' or 'pm'\n ampm: function ampm(input) {\n var which = 'am';\n var hour = this.hour();\n\n if (hour >= 12) {\n which = 'pm';\n }\n\n if (typeof input !== 'string') {\n return which;\n } //okay, we're doing a setter\n\n\n var s = this.clone();\n input = input.toLowerCase().trim(); //ampm should never change the day\n // - so use `.hour(n)` instead of `.minus(12,'hour')`\n\n if (hour >= 12 && input === 'am') {\n //noon is 12pm\n hour -= 12;\n return s.hour(hour);\n }\n\n if (hour < 12 && input === 'pm') {\n hour += 12;\n return s.hour(hour);\n }\n\n return s;\n },\n //some hard-coded times of day, like 'noon'\n dayTime: function dayTime(str) {\n if (str !== undefined) {\n var times = {\n morning: '7:00am',\n breakfast: '7:00am',\n noon: '12:00am',\n lunch: '12:00pm',\n afternoon: '2:00pm',\n evening: '6:00pm',\n dinner: '6:00pm',\n night: '11:00pm',\n midnight: '23:59pm'\n };\n var s = this.clone();\n str = str || '';\n str = str.toLowerCase();\n\n if (times.hasOwnProperty(str) === true) {\n s = s.time(times[str]);\n }\n\n return s;\n }\n\n var h = this.hour();\n\n if (h < 6) {\n return 'night';\n }\n\n if (h < 12) {\n //until noon\n return 'morning';\n }\n\n if (h < 17) {\n //until 5pm\n return 'afternoon';\n }\n\n if (h < 22) {\n //until 10pm\n return 'evening';\n }\n\n return 'night';\n },\n //parse a proper iso string\n iso: function iso(num) {\n if (num !== undefined) {\n return this.set(num);\n }\n\n return this.format('iso');\n }\n };\n var _01Time = methods$3;\n\n var methods$2 = {\n // # day in the month\n date: function date(num) {\n if (num !== undefined) {\n var s = this.clone();\n s.epoch = set.date(s, num);\n return s;\n }\n\n return this.d.getDate();\n },\n //like 'wednesday' (hard!)\n day: function day(input) {\n if (input === undefined) {\n return this.d.getDay();\n }\n\n var original = this.clone();\n var want = input; // accept 'wednesday'\n\n if (typeof input === 'string') {\n input = input.toLowerCase();\n\n if (days.aliases.hasOwnProperty(input)) {\n want = days.aliases[input];\n } else {\n want = days[\"short\"]().indexOf(input);\n\n if (want === -1) {\n want = days[\"long\"]().indexOf(input);\n }\n }\n } //move approx\n\n\n var day = this.d.getDay();\n var diff = day - want;\n var s = this.subtract(diff, 'days'); //tighten it back up\n\n walk_1(s, {\n hour: original.hour(),\n minute: original.minute(),\n second: original.second()\n });\n return s;\n },\n //these are helpful name-wrappers\n dayName: function dayName(input) {\n if (input === undefined) {\n return days[\"long\"]()[this.day()];\n }\n\n var s = this.clone();\n s = s.day(input);\n return s;\n },\n //either name or number\n month: function month(input) {\n if (input !== undefined) {\n var s = this.clone();\n s.epoch = set.month(s, input);\n return s;\n }\n\n return this.d.getMonth();\n }\n };\n var _02Date = methods$2;\n\n var clearMinutes = function clearMinutes(s) {\n s = s.minute(0);\n s = s.second(0);\n s = s.millisecond(1);\n return s;\n };\n\n var methods$1 = {\n // day 0-366\n dayOfYear: function dayOfYear(num) {\n if (num !== undefined) {\n var s = this.clone();\n s.epoch = set.dayOfYear(s, num);\n return s;\n } //days since newyears - jan 1st is 1, jan 2nd is 2...\n\n\n var sum = 0;\n var month = this.d.getMonth();\n var tmp; //count the num days in each month\n\n for (var i = 1; i <= month; i++) {\n tmp = new Date();\n tmp.setDate(1);\n tmp.setFullYear(this.d.getFullYear()); //the year matters, because leap-years\n\n tmp.setHours(1);\n tmp.setMinutes(1);\n tmp.setMonth(i);\n tmp.setHours(-2); //the last day of the month\n\n sum += tmp.getDate();\n }\n\n return sum + this.d.getDate();\n },\n //since the start of the year\n week: function week(num) {\n // week-setter\n if (num !== undefined) {\n var s = this.clone();\n s = s.month(0);\n s = s.date(1);\n s = s.day('monday');\n s = clearMinutes(s); //first week starts first Thurs in Jan\n // so mon dec 28th is 1st week\n // so mon dec 29th is not the week\n\n if (s.monthName() === 'december' && s.date() >= 28) {\n s = s.add(1, 'week');\n }\n\n num -= 1; //1-based\n\n s = s.add(num, 'weeks');\n return s;\n } //find-out which week it is\n\n\n var tmp = this.clone();\n tmp = tmp.month(0);\n tmp = tmp.date(1);\n tmp = clearMinutes(tmp);\n tmp = tmp.day('monday'); //don't go into last-year\n\n if (tmp.monthName() === 'december' && tmp.date() >= 28) {\n tmp = tmp.add(1, 'week');\n } // is first monday the 1st?\n\n\n var toAdd = 1;\n\n if (tmp.date() === 1) {\n toAdd = 0;\n }\n\n tmp = tmp.minus(1, 'second');\n var thisOne = this.epoch; //if the week technically hasn't started yet\n\n if (tmp.epoch > thisOne) {\n return 1;\n } //speed it up, if we can\n\n\n var i = 0;\n var skipWeeks = this.month() * 4;\n tmp.epoch += milliseconds.week * skipWeeks;\n i += skipWeeks;\n\n for (; i <= 52; i++) {\n if (tmp.epoch > thisOne) {\n return i + toAdd;\n }\n\n tmp = tmp.add(1, 'week');\n }\n\n return 52;\n },\n //'january'\n monthName: function monthName(input) {\n if (input === undefined) {\n return months$1[\"long\"]()[this.month()];\n }\n\n var s = this.clone();\n s = s.month(input);\n return s;\n },\n //q1, q2, q3, q4\n quarter: function quarter(num) {\n if (num !== undefined) {\n if (typeof num === 'string') {\n num = num.replace(/^q/i, '');\n num = parseInt(num, 10);\n }\n\n if (quarters[num]) {\n var s = this.clone();\n var _month = quarters[num][0];\n s = s.month(_month);\n s = s.date(1);\n s = s.startOf('day');\n return s;\n }\n }\n\n var month = this.d.getMonth();\n\n for (var i = 1; i < quarters.length; i++) {\n if (month < quarters[i][0]) {\n return i - 1;\n }\n }\n\n return 4;\n },\n //spring, summer, winter, fall\n season: function season(input) {\n var hem = 'north';\n\n if (this.hemisphere() === 'South') {\n hem = 'south';\n }\n\n if (input !== undefined) {\n var s = this.clone();\n\n for (var i = 0; i < seasons[hem].length; i++) {\n if (input === seasons[hem][i][0]) {\n s = s.month(seasons[hem][i][1]);\n s = s.date(1);\n s = s.startOf('day');\n }\n }\n\n return s;\n }\n\n var month = this.d.getMonth();\n\n for (var _i = 0; _i < seasons[hem].length - 1; _i++) {\n if (month >= seasons[hem][_i][1] && month < seasons[hem][_i + 1][1]) {\n return seasons[hem][_i][0];\n }\n }\n\n return 'winter';\n },\n //the year number\n year: function year(num) {\n if (num !== undefined) {\n var s = this.clone();\n s.epoch = set.year(s, num);\n return s;\n }\n\n return this.d.getFullYear();\n },\n //bc/ad years\n era: function era(str) {\n if (str !== undefined) {\n var s = this.clone();\n str = str.toLowerCase(); //TODO: there is no year-0AD i think. may have off-by-1 error here\n\n var year = s.d.getFullYear(); //make '1992' into 1992bc..\n\n if (str === 'bc' && year > 0) {\n s.epoch = set.year(s, year * -1);\n } //make '1992bc' into '1992'\n\n\n if (str === 'ad' && year < 0) {\n s.epoch = set.year(s, year * -1);\n }\n\n return s;\n }\n\n if (this.d.getFullYear() < 0) {\n return 'BC';\n }\n\n return 'AD';\n },\n // 2019 -> 2010\n decade: function decade(input) {\n if (input !== undefined) {\n input = String(input);\n input = input.replace(/([0-9])'?s$/, '$1'); //1950's\n\n input = input.replace(/([0-9])(th|rd|st|nd)/, '$1'); //fix ordinals\n\n if (!input) {\n console.warn('Spacetime: Invalid decade input');\n return this;\n } // assume 20th century?? for '70s'.\n\n\n if (input.length === 2 && /[0-9][0-9]/.test(input)) {\n input = '19' + input;\n }\n\n var year = Number(input);\n\n if (isNaN(year)) {\n return this;\n } // round it down to the decade\n\n\n year = Math.floor(year / 10) * 10;\n return this.year(year); //.startOf('decade')\n }\n\n return this.startOf('decade').year();\n },\n // 1950 -> 19+1\n century: function century(input) {\n if (input !== undefined) {\n if (typeof input === 'string') {\n input = input.replace(/([0-9])(th|rd|st|nd)/, '$1'); //fix ordinals\n\n input = input.replace(/([0-9]+) ?(b\\.?c\\.?|a\\.?d\\.?)/i, function (a, b, c) {\n if (c.match(/b\\.?c\\.?/i)) {\n b = '-' + b;\n }\n\n return b;\n });\n input = input.replace(/c$/, ''); //20thC\n }\n\n var year = Number(input);\n\n if (isNaN(input)) {\n console.warn('Spacetime: Invalid century input');\n return this;\n } // there is no century 0\n\n\n if (year === 0) {\n year = 1;\n }\n\n if (year >= 0) {\n year = (year - 1) * 100;\n } else {\n year = (year + 1) * 100;\n }\n\n return this.year(year);\n } // century getter\n\n\n var num = this.startOf('century').year();\n num = Math.floor(num / 100);\n\n if (num < 0) {\n return num - 1;\n }\n\n return num + 1;\n },\n // 2019 -> 2+1\n millenium: function millenium(input) {\n if (input !== undefined) {\n if (typeof input === 'string') {\n input = input.replace(/([0-9])(th|rd|st|nd)/, '$1'); //fix ordinals\n\n input = Number(input);\n\n if (isNaN(input)) {\n console.warn('Spacetime: Invalid millenium input');\n return this;\n }\n }\n\n if (input > 0) {\n input -= 1;\n }\n\n var year = input * 1000; // there is no year 0\n\n if (year === 0) {\n year = 1;\n }\n\n return this.year(year);\n } // get the current millenium\n\n\n var num = Math.floor(this.year() / 1000);\n\n if (num >= 0) {\n num += 1;\n }\n\n return num;\n }\n };\n var _03Year = methods$1;\n\n var methods = Object.assign({}, _01Time, _02Date, _03Year); //aliases\n\n methods.milliseconds = methods.millisecond;\n methods.seconds = methods.second;\n methods.minutes = methods.minute;\n methods.hours = methods.hour;\n methods.hour24 = methods.hour;\n methods.h12 = methods.hour12;\n methods.h24 = methods.hour24;\n methods.days = methods.day;\n\n var addMethods$4 = function addMethods(Space) {\n //hook the methods into prototype\n Object.keys(methods).forEach(function (k) {\n Space.prototype[k] = methods[k];\n });\n };\n\n var query = addMethods$4;\n\n var isLeapYear = fns.isLeapYear;\n\n var getMonthLength = function getMonthLength(month, year) {\n if (month === 1 && isLeapYear(year)) {\n return 29;\n }\n\n return monthLengths_1[month];\n }; //month is the one thing we 'model/compute'\n //- because ms-shifting can be off by enough\n\n\n var rollMonth = function rollMonth(want, old) {\n //increment year\n if (want.month > 0) {\n var years = parseInt(want.month / 12, 10);\n want.year = old.year() + years;\n want.month = want.month % 12;\n } else if (want.month < 0) {\n //decrement year\n var _years = Math.floor(Math.abs(want.month) / 13, 10);\n\n _years = Math.abs(_years) + 1;\n want.year = old.year() - _years; //ignore extras\n\n want.month = want.month % 12;\n want.month = want.month + 12;\n\n if (want.month === 12) {\n want.month = 0;\n }\n }\n\n return want;\n }; // briefly support day=-2 (this does not need to be perfect.)\n\n\n var rollDaysDown = function rollDaysDown(want, old, sum) {\n want.year = old.year();\n want.month = old.month();\n var date = old.date();\n want.date = date - Math.abs(sum);\n\n while (want.date < 1) {\n want.month -= 1;\n\n if (want.month < 0) {\n want.month = 11;\n want.year -= 1;\n }\n\n var max = getMonthLength(want.month, want.year);\n want.date += max;\n }\n\n return want;\n }; // briefly support day=33 (this does not need to be perfect.)\n\n\n var rollDaysUp = function rollDaysUp(want, old, sum) {\n var year = old.year();\n var month = old.month();\n var max = getMonthLength(month, year);\n\n while (sum > max) {\n sum -= max;\n month += 1;\n\n if (month >= 12) {\n month -= 12;\n year += 1;\n }\n\n max = getMonthLength(month, year);\n }\n\n want.month = month;\n want.date = sum;\n return want;\n };\n\n var _model = {\n months: rollMonth,\n days: rollDaysUp,\n daysBack: rollDaysDown\n };\n\n // but briefly:\n // millisecond-math, and some post-processing covers most-things\n // we 'model' the calendar here only a little bit\n // and that usually works-out...\n\n var order = ['millisecond', 'second', 'minute', 'hour', 'date', 'month'];\n var keep = {\n second: order.slice(0, 1),\n minute: order.slice(0, 2),\n quarterhour: order.slice(0, 2),\n hour: order.slice(0, 3),\n date: order.slice(0, 4),\n month: order.slice(0, 4),\n quarter: order.slice(0, 4),\n season: order.slice(0, 4),\n year: order,\n decade: order,\n century: order\n };\n keep.week = keep.hour;\n keep.season = keep.date;\n keep.quarter = keep.date; // Units need to be dst adjuested\n\n var dstAwareUnits = {\n year: true,\n quarter: true,\n season: true,\n month: true,\n week: true,\n day: true\n };\n var keepDate = {\n month: true,\n quarter: true,\n season: true,\n year: true\n };\n\n var addMethods$3 = function addMethods(SpaceTime) {\n SpaceTime.prototype.add = function (num, unit) {\n var s = this.clone();\n\n if (!unit || num === 0) {\n return s; //don't bother\n }\n\n var old = this.clone();\n unit = fns.normalize(unit);\n\n if (unit === 'millisecond') {\n s.epoch += num;\n return s;\n } // support 'fortnight' alias\n\n\n if (unit === 'fortnight') {\n num *= 2;\n unit = 'week';\n } //move forward by the estimated milliseconds (rough)\n\n\n if (milliseconds[unit]) {\n s.epoch += milliseconds[unit] * num;\n } else if (unit === 'week') {\n s.epoch += milliseconds.day * (num * 7);\n } else if (unit === 'quarter' || unit === 'season') {\n s.epoch += milliseconds.month * (num * 3);\n } else if (unit === 'quarterhour') {\n s.epoch += milliseconds.minute * 15 * num;\n } //now ensure our milliseconds/etc are in-line\n\n\n var want = {};\n\n if (keep[unit]) {\n keep[unit].forEach(function (u) {\n want[u] = old[u]();\n });\n }\n\n if (dstAwareUnits[unit]) {\n var diff = old.timezone().current.offset - s.timezone().current.offset;\n s.epoch += diff * 3600 * 1000;\n } //ensure month/year has ticked-over\n\n\n if (unit === 'month') {\n want.month = old.month() + num; //month is the one unit we 'model' directly\n\n want = _model.months(want, old);\n } //support coercing a week, too\n\n\n if (unit === 'week') {\n var sum = old.date() + num * 7;\n\n if (sum <= 28 && sum > 1) {\n want.date = sum;\n }\n } //support 25-hour day-changes on dst-changes\n else if (unit === 'date') {\n if (num < 0) {\n want = _model.daysBack(want, old, num);\n } else {\n //specify a naive date number, if it's easy to do...\n var _sum = old.date() + num; // ok, model this one too\n\n\n want = _model.days(want, old, _sum);\n } //manually punt it if we haven't moved at all..\n\n\n if (num !== 0 && old.isSame(s, 'day')) {\n want.date = old.date() + num;\n }\n } // ensure a quarter is 3 months over\n else if (unit === 'quarter') {\n want.month = old.month() + num * 3;\n want.year = old.year(); // handle rollover\n\n if (want.month < 0) {\n var years = Math.floor(want.month / 12);\n var remainder = want.month + Math.abs(years) * 12;\n want.month = remainder;\n want.year += years;\n } else if (want.month >= 12) {\n var _years = Math.floor(want.month / 12);\n\n want.month = want.month % 12;\n want.year += _years;\n }\n\n want.date = old.date();\n } //ensure year has changed (leap-years)\n else if (unit === 'year') {\n var wantYear = old.year() + num;\n var haveYear = s.year();\n\n if (haveYear < wantYear) {\n s.epoch += milliseconds.day;\n } else if (haveYear > wantYear) {\n s.epoch += milliseconds.day;\n }\n } //these are easier\n else if (unit === 'decade') {\n want.year = s.year() + 10;\n } else if (unit === 'century') {\n want.year = s.year() + 100;\n } //keep current date, unless the month doesn't have it.\n\n\n if (keepDate[unit]) {\n var max = monthLengths_1[want.month];\n want.date = old.date();\n\n if (want.date > max) {\n want.date = max;\n }\n }\n\n if (Object.keys(want).length > 1) {\n walk_1(s, want);\n }\n\n return s;\n }; //subtract is only add *-1\n\n\n SpaceTime.prototype.subtract = function (num, unit) {\n var s = this.clone();\n return s.add(num * -1, unit);\n }; //add aliases\n\n\n SpaceTime.prototype.minus = SpaceTime.prototype.subtract;\n SpaceTime.prototype.plus = SpaceTime.prototype.add;\n };\n\n var add = addMethods$3;\n\n //make a string, for easy comparison between dates\n var print = {\n millisecond: function millisecond(s) {\n return s.epoch;\n },\n second: function second(s) {\n return [s.year(), s.month(), s.date(), s.hour(), s.minute(), s.second()].join('-');\n },\n minute: function minute(s) {\n return [s.year(), s.month(), s.date(), s.hour(), s.minute()].join('-');\n },\n hour: function hour(s) {\n return [s.year(), s.month(), s.date(), s.hour()].join('-');\n },\n day: function day(s) {\n return [s.year(), s.month(), s.date()].join('-');\n },\n week: function week(s) {\n return [s.year(), s.week()].join('-');\n },\n month: function month(s) {\n return [s.year(), s.month()].join('-');\n },\n quarter: function quarter(s) {\n return [s.year(), s.quarter()].join('-');\n },\n year: function year(s) {\n return s.year();\n }\n };\n print.date = print.day;\n\n var addMethods$2 = function addMethods(SpaceTime) {\n SpaceTime.prototype.isSame = function (b, unit) {\n var tzAware = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n var a = this;\n\n if (!unit) {\n return null;\n } // support swapped params\n\n\n if (typeof b === 'string' && _typeof(unit) === 'object') {\n var tmp = b;\n b = unit;\n unit = tmp;\n }\n\n if (typeof b === 'string' || typeof b === 'number') {\n b = new SpaceTime(b, this.timezone.name);\n } //support 'seconds' aswell as 'second'\n\n\n unit = unit.replace(/s$/, ''); // make them the same timezone for proper comparison\n\n if (tzAware === true && a.tz !== b.tz) {\n b = b.clone();\n b.tz = a.tz;\n }\n\n if (print[unit]) {\n return print[unit](a) === print[unit](b);\n }\n\n return null;\n };\n };\n\n var same = addMethods$2;\n\n var addMethods$1 = function addMethods(SpaceTime) {\n var methods = {\n isAfter: function isAfter(d) {\n d = fns.beADate(d, this);\n var epoch = fns.getEpoch(d);\n\n if (epoch === null) {\n return null;\n }\n\n return this.epoch > epoch;\n },\n isBefore: function isBefore(d) {\n d = fns.beADate(d, this);\n var epoch = fns.getEpoch(d);\n\n if (epoch === null) {\n return null;\n }\n\n return this.epoch < epoch;\n },\n isEqual: function isEqual(d) {\n d = fns.beADate(d, this);\n var epoch = fns.getEpoch(d);\n\n if (epoch === null) {\n return null;\n }\n\n return this.epoch === epoch;\n },\n isBetween: function isBetween(start, end) {\n var isInclusive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n start = fns.beADate(start, this);\n end = fns.beADate(end, this);\n var startEpoch = fns.getEpoch(start);\n\n if (startEpoch === null) {\n return null;\n }\n\n var endEpoch = fns.getEpoch(end);\n\n if (endEpoch === null) {\n return null;\n }\n\n if (isInclusive) {\n return this.isBetween(start, end) || this.isEqual(start) || this.isEqual(end);\n }\n\n return startEpoch < this.epoch && this.epoch < endEpoch;\n }\n }; //hook them into proto\n\n Object.keys(methods).forEach(function (k) {\n SpaceTime.prototype[k] = methods[k];\n });\n };\n\n var compare = addMethods$1;\n\n var addMethods = function addMethods(SpaceTime) {\n var methods = {\n i18n: function i18n(data) {\n //change the day names\n if (fns.isObject(data.days)) {\n days.set(data.days);\n } //change the month names\n\n\n if (fns.isObject(data.months)) {\n months$1.set(data.months);\n } // change the the display style of the month / day names\n\n\n if (fns.isBoolean(data.useTitleCase)) {\n caseFormat.set(data.useTitleCase);\n }\n }\n }; //hook them into proto\n\n Object.keys(methods).forEach(function (k) {\n SpaceTime.prototype[k] = methods[k];\n });\n };\n\n var i18n = addMethods;\n\n var timezones = unpack; //fake timezone-support, for fakers (es5 class)\n\n var SpaceTime = function SpaceTime(input$1, tz) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n //the holy moment\n this.epoch = null; //the shift for the given timezone\n\n this.tz = find(tz, timezones); //whether to output warnings to console\n\n this.silent = options.silent || true; // favour british interpretation of 02/02/2018, etc\n\n this.british = options.dmy || options.british; //does the week start on sunday, or monday:\n\n this._weekStart = 1; //default to monday\n\n if (options.weekStart !== undefined) {\n this._weekStart = options.weekStart;\n } // the reference today date object, (for testing)\n\n\n this._today = {};\n\n if (options.today !== undefined) {\n this._today = options.today;\n } //add getter/setters\n\n\n Object.defineProperty(this, 'd', {\n //return a js date object\n get: function get() {\n var offset = quick(this); //every computer is somewhere- get this computer's built-in offset\n\n var bias = new Date(this.epoch).getTimezoneOffset() || 0; //movement\n\n var shift = bias + offset * 60; //in minutes\n\n shift = shift * 60 * 1000; //in ms\n //remove this computer's offset\n\n var epoch = this.epoch + shift;\n var d = new Date(epoch);\n return d;\n }\n }); //add this data on the object, to allow adding new timezones\n\n Object.defineProperty(this, 'timezones', {\n get: function get() {\n return timezones;\n },\n set: function set(obj) {\n timezones = obj;\n return obj;\n }\n }); //parse the various formats\n\n var tmp = input(this, input$1, tz);\n this.epoch = tmp.epoch;\n }; //(add instance methods to prototype)\n\n\n Object.keys(methods_1).forEach(function (k) {\n SpaceTime.prototype[k] = methods_1[k];\n }); // ¯\\_(ツ)_/¯\n\n SpaceTime.prototype.clone = function () {\n return new SpaceTime(this.epoch, this.tz, {\n silent: this.silent,\n weekStart: this._weekStart,\n today: this._today\n });\n }; //return native date object at the same epoch\n\n\n SpaceTime.prototype.toLocalDate = function () {\n return new Date(this.epoch);\n }; //append more methods\n\n\n query(SpaceTime);\n add(SpaceTime);\n same(SpaceTime);\n compare(SpaceTime);\n i18n(SpaceTime);\n var spacetime = SpaceTime;\n\n var whereIts = function whereIts(a, b) {\n var start = new spacetime(null);\n var end = new spacetime(null);\n start = start.time(a); //if b is undefined, use as 'within one hour'\n\n if (b) {\n end = end.time(b);\n } else {\n end = start.add(59, 'minutes');\n }\n\n var startHour = start.hour();\n var endHour = end.hour();\n var tzs = Object.keys(start.timezones).filter(function (tz) {\n if (tz.indexOf('/') === -1) {\n return false;\n }\n\n var m = new spacetime(null, tz);\n var hour = m.hour(); //do 'calendar-compare' not real-time-compare\n\n if (hour >= startHour && hour <= endHour) {\n //test minutes too, if applicable\n if (hour === startHour && m.minute() < start.minute()) {\n return false;\n }\n\n if (hour === endHour && m.minute() > end.minute()) {\n return false;\n }\n\n return true;\n }\n\n return false;\n });\n return tzs;\n };\n\n var whereIts_1 = whereIts;\n\n var _version = '6.13.0';\n\n var main = function main(input, tz, options) {\n return new spacetime(input, tz, options);\n }; // set all properties of a given 'today' object\n\n\n var setToday = function setToday(s) {\n var today = s._today || {};\n Object.keys(today).forEach(function (k) {\n s = s[k](today[k]);\n });\n return s;\n }; //some helper functions on the main method\n\n\n main.now = function (tz, options) {\n var s = new spacetime(new Date().getTime(), tz, options);\n s = setToday(s);\n return s;\n };\n\n main.today = function (tz, options) {\n var s = new spacetime(new Date().getTime(), tz, options);\n s = setToday(s);\n return s.startOf('day');\n };\n\n main.tomorrow = function (tz, options) {\n var s = new spacetime(new Date().getTime(), tz, options);\n s = setToday(s);\n return s.add(1, 'day').startOf('day');\n };\n\n main.yesterday = function (tz, options) {\n var s = new spacetime(new Date().getTime(), tz, options);\n s = setToday(s);\n return s.subtract(1, 'day').startOf('day');\n };\n\n main.extend = function (obj) {\n Object.keys(obj).forEach(function (k) {\n spacetime.prototype[k] = obj[k];\n });\n return this;\n };\n\n main.timezones = function () {\n var s = new spacetime();\n return s.timezones;\n }; //find tz by time\n\n\n main.whereIts = whereIts_1;\n main.version = _version; //aliases:\n\n main.plugin = main.extend;\n var src = main;\n\n return src;\n\n})));\n","// some opinionated-but-common-sense timezone abbreviations\n// these timezone abbreviations are wholly made-up by me, Spencer Kelly, with no expertise in geography\n// generated humbly from https://github.com/spencermountain/spacetime-informal\nconst spacetime = require('spacetime')\n\nconst america = 'America/'\nconst asia = 'Asia/'\nconst europe = 'Europe/'\nconst africa = 'Africa/'\nconst aus = 'Australia/'\nconst pac = 'Pacific/'\n\nconst informal = {\n //europe\n 'british summer time': europe + 'London',\n bst: europe + 'London',\n 'british time': europe + 'London',\n 'britain time': europe + 'London',\n 'irish summer time': europe + 'Dublin',\n 'irish time': europe + 'Dublin',\n ireland: europe + 'Dublin',\n 'central european time': europe + 'Berlin',\n cet: europe + 'Berlin',\n 'central european summer time': europe + 'Berlin',\n cest: europe + 'Berlin',\n 'central europe': europe + 'Berlin',\n 'eastern european time': europe + 'Riga',\n eet: europe + 'Riga',\n 'eastern european summer time': europe + 'Riga',\n eest: europe + 'Riga',\n 'eastern europe time': europe + 'Riga',\n 'western european time': europe + 'Lisbon',\n // wet: europe+'Lisbon',\n 'western european summer time': europe + 'Lisbon',\n // west: europe+'Lisbon',\n 'western europe': europe + 'Lisbon',\n 'turkey standard time': europe + 'Istanbul',\n trt: europe + 'Istanbul',\n 'turkish time': europe + 'Istanbul',\n\n //africa\n etc: africa + 'Freetown',\n utc: africa + 'Freetown',\n 'greenwich standard time': africa + 'Freetown',\n gmt: africa + 'Freetown',\n 'east africa time': africa + 'Nairobi',\n // eat: africa+'Nairobi',\n 'east african time': africa + 'Nairobi',\n 'eastern africa time': africa + 'Nairobi',\n 'central africa time': africa + 'Khartoum',\n // cat: africa+'Khartoum',\n 'central african time': africa + 'Khartoum',\n 'south africa standard time': africa + 'Johannesburg',\n sast: africa + 'Johannesburg',\n 'southern africa': africa + 'Johannesburg',\n 'south african': africa + 'Johannesburg',\n 'west africa standard time': africa + 'Lagos',\n // wat: africa+'Lagos',\n 'western africa time': africa + 'Lagos',\n 'west african time': africa + 'Lagos',\n\n 'australian central standard time': aus + 'Adelaide',\n acst: aus + 'Adelaide',\n 'australian central daylight time': aus + 'Adelaide',\n acdt: aus + 'Adelaide',\n 'australia central': aus + 'Adelaide',\n 'australian eastern standard time': aus + 'Brisbane',\n aest: aus + 'Brisbane',\n 'australian eastern daylight time': aus + 'Brisbane',\n aedt: aus + 'Brisbane',\n 'australia east': aus + 'Brisbane',\n 'australian western standard time': aus + 'Perth',\n awst: aus + 'Perth',\n 'australian western daylight time': aus + 'Perth',\n awdt: aus + 'Perth',\n 'australia west': aus + 'Perth',\n 'australian central western standard time': aus + 'Eucla',\n acwst: aus + 'Eucla',\n 'australia central west': aus + 'Eucla',\n 'lord howe standard time': aus + 'Lord_Howe',\n lhst: aus + 'Lord_Howe',\n 'lord howe daylight time': aus + 'Lord_Howe',\n lhdt: aus + 'Lord_Howe',\n 'russian standard time': europe + 'Moscow',\n msk: europe + 'Moscow',\n russian: europe + 'Moscow',\n\n //america\n 'central standard time': america + 'Chicago',\n 'central time': america + 'Chicago',\n cst: america + 'Havana',\n 'central daylight time': america + 'Chicago',\n cdt: america + 'Havana',\n 'mountain standard time': america + 'Denver',\n 'mountain time': america + 'Denver',\n mst: america + 'Denver',\n 'mountain daylight time': america + 'Denver',\n mdt: america + 'Denver',\n 'atlantic standard time': america + 'Halifax',\n 'atlantic time': america + 'Halifax',\n ast: asia + 'Baghdad',\n 'atlantic daylight time': america + 'Halifax',\n adt: america + 'Halifax',\n 'eastern standard time': america + 'New_York',\n 'eastern time': america + 'New_York',\n est: america + 'New_York',\n 'eastern daylight time': america + 'New_York',\n edt: america + 'New_York',\n 'pacific time': america + 'Los_Angeles',\n 'pacific standard time': america + 'Los_Angeles',\n pst: america + 'Los_Angeles',\n 'pacific daylight time': america + 'Los_Angeles',\n pdt: america + 'Los_Angeles',\n 'alaskan standard time': america + 'Anchorage',\n 'alaskan time': america + 'Anchorage',\n ahst: america + 'Anchorage',\n 'alaskan daylight time': america + 'Anchorage',\n ahdt: america + 'Anchorage',\n 'hawaiian standard time': pac + 'Honolulu',\n 'hawaiian time': pac + 'Honolulu',\n hst: pac + 'Honolulu',\n 'aleutian time': pac + 'Honolulu',\n 'hawaii time': pac + 'Honolulu',\n 'newfoundland standard time': america + 'St_Johns',\n 'newfoundland time': america + 'St_Johns',\n nst: america + 'St_Johns',\n 'newfoundland daylight time': america + 'St_Johns',\n ndt: america + 'St_Johns',\n 'brazil time': america + 'Sao_Paulo',\n brt: america + 'Sao_Paulo',\n brasília: america + 'Sao_Paulo',\n brasilia: america + 'Sao_Paulo',\n 'brazilian time': america + 'Sao_Paulo',\n 'argentina time': america + 'Buenos_Aires',\n // art: a+'Buenos_Aires',\n 'argentinian time': america + 'Buenos_Aires',\n 'amazon time': america + 'Manaus',\n amt: america + 'Manaus',\n 'amazonian time': america + 'Manaus',\n 'easter island standard time': 'Chile/Easterisland',\n east: 'Chile/Easterisland',\n 'easter island summer time': 'Chile/Easterisland',\n easst: 'Chile/Easterisland',\n 'venezuelan standard time': america + 'Caracas',\n 'venezuelan time': america + 'Caracas',\n vet: america + 'Caracas',\n 'venezuela time': america + 'Caracas',\n 'paraguay time': america + 'Asuncion',\n pyt: america + 'Asuncion',\n 'paraguay summer time': america + 'Asuncion',\n pyst: america + 'Asuncion',\n 'cuba standard time': america + 'Havana',\n 'cuba time': america + 'Havana',\n 'cuba daylight time': america + 'Havana',\n 'cuban time': america + 'Havana',\n 'bolivia time': america + 'La_Paz',\n // bot: a+'La_Paz',\n 'bolivian time': america + 'La_Paz',\n 'colombia time': america + 'Bogota',\n cot: america + 'Bogota',\n 'colombian time': america + 'Bogota',\n 'acre time': america + 'Eirunepe',\n // act: a+'Eirunepe',\n 'peru time': america + 'Lima',\n // pet: a+'Lima',\n 'chile standard time': america + 'Punta_Arenas',\n 'chile time': america + 'Punta_Arenas',\n clst: america + 'Punta_Arenas',\n 'chile summer time': america + 'Punta_Arenas',\n cldt: america + 'Punta_Arenas',\n 'uruguay time': america + 'Montevideo',\n uyt: america + 'Montevideo',\n\n //asia\n ist: asia + 'Jerusalem',\n 'arabic standard time': asia + 'Baghdad',\n 'arabic time': asia + 'Baghdad',\n 'arab time': asia + 'Baghdad',\n 'iran standard time': asia + 'Tehran',\n 'iran time': asia + 'Tehran',\n irst: asia + 'Tehran',\n 'iran daylight time': asia + 'Tehran',\n irdt: asia + 'Tehran',\n iranian: asia + 'Tehran',\n 'pakistan standard time': asia + 'Karachi',\n 'pakistan time': asia + 'Karachi',\n pkt: asia + 'Karachi',\n 'india standard time': asia + 'Kolkata',\n 'indian time': asia + 'Kolkata',\n 'indochina time': asia + 'Bangkok',\n ict: asia + 'Bangkok',\n 'south east asia': asia + 'Bangkok',\n 'china standard time': asia + 'Shanghai',\n ct: asia + 'Shanghai',\n 'chinese time': asia + 'Shanghai',\n 'alma-ata time': asia + 'Almaty',\n almt: asia + 'Almaty',\n 'oral time': asia + 'Oral',\n 'orat time': asia + 'Oral',\n 'yakutsk time': asia + 'Yakutsk',\n yakt: asia + 'Yakutsk',\n 'gulf standard time': asia + 'Dubai',\n 'gulf time': asia + 'Dubai',\n gst: asia + 'Dubai',\n uae: asia + 'Dubai',\n 'hong kong time': asia + 'Hong_Kong',\n hkt: asia + 'Hong_Kong',\n 'western indonesian time': asia + 'Jakarta',\n wib: asia + 'Jakarta',\n 'indonesia time': asia + 'Jakarta',\n 'central indonesian time': asia + 'Makassar',\n wita: asia + 'Makassar',\n 'israel daylight time': asia + 'Jerusalem',\n idt: asia + 'Jerusalem',\n 'israel standard time': asia + 'Jerusalem',\n 'israel time': asia + 'Jerusalem',\n israeli: asia + 'Jerusalem',\n 'krasnoyarsk time': asia + 'Krasnoyarsk',\n krat: asia + 'Krasnoyarsk',\n 'malaysia time': asia + 'Kuala_Lumpur',\n myt: asia + 'Kuala_Lumpur',\n 'singapore time': asia + 'Singapore',\n sgt: asia + 'Singapore',\n 'korea standard time': asia + 'Seoul',\n 'korea time': asia + 'Seoul',\n kst: asia + 'Seoul',\n 'korean time': asia + 'Seoul',\n 'uzbekistan time': asia + 'Samarkand',\n uzt: asia + 'Samarkand',\n 'vladivostok time': asia + 'Vladivostok',\n vlat: asia + 'Vladivostok',\n\n //indian\n 'maldives time': 'Indian/Maldives',\n mvt: 'Indian/Maldives',\n 'mauritius time': 'Indian/Mauritius',\n mut: 'Indian/Mauritius',\n\n // pacific\n 'marshall islands time': pac + 'Kwajalein',\n mht: pac + 'Kwajalein',\n 'samoa standard time': pac + 'Midway',\n sst: pac + 'Midway',\n 'somoan time': pac + 'Midway',\n 'chamorro standard time': pac + 'Guam',\n chst: pac + 'Guam',\n 'papua new guinea time': pac + 'Bougainville',\n pgt: pac + 'Bougainville',\n}\n\n//add the official iana zonefile names\nlet iana = spacetime().timezones\nlet formal = Object.keys(iana).reduce((h, k) => {\n h[k] = k\n return h\n}, {})\nmodule.exports = Object.assign({}, informal, formal)\n","module.exports = [\n 'weekday',\n\n 'summer',\n 'winter',\n 'autumn',\n\n 'some day',\n 'one day',\n 'all day',\n 'some point',\n\n 'eod',\n 'eom',\n 'eoy',\n 'standard time',\n 'daylight time',\n 'tommorrow',\n]\n","module.exports = [\n 'centuries',\n 'century',\n 'day',\n 'days',\n 'decade',\n 'decades',\n 'hour',\n 'hours',\n 'hr',\n 'hrs',\n 'millisecond',\n 'milliseconds',\n 'minute',\n 'minutes',\n 'min',\n 'mins',\n 'month',\n 'months',\n 'seconds',\n 'sec',\n 'secs',\n 'week end',\n 'week ends',\n 'weekend',\n 'weekends',\n 'week',\n 'weeks',\n 'wk',\n 'wks',\n 'year',\n 'years',\n 'yr',\n 'yrs',\n 'quarter',\n // 'quarters',\n 'qtr',\n 'qtrs',\n 'season',\n 'seasons',\n]\n","module.exports = [\n 'all hallows eve',\n 'all saints day',\n 'all sts day',\n 'april fools',\n 'armistice day',\n 'australia day',\n 'bastille day',\n 'boxing day',\n 'canada day',\n 'christmas eve',\n 'christmas',\n 'cinco de mayo',\n 'day of the dead',\n 'dia de muertos',\n 'dieciseis de septiembre',\n 'emancipation day',\n 'grito de dolores',\n 'groundhog day',\n 'halloween',\n 'harvey milk day',\n 'inauguration day',\n 'independence day',\n 'independents day',\n 'juneteenth',\n 'labour day',\n 'national freedom day',\n 'national nurses day',\n 'new years eve',\n 'new years',\n 'purple heart day',\n 'rememberance day',\n 'rosa parks day',\n 'saint andrews day',\n 'saint patricks day',\n 'saint stephens day',\n 'saint valentines day',\n 'st andrews day',\n 'st patricks day',\n 'st stephens day',\n 'st valentines day ',\n 'valentines day',\n 'valentines',\n 'veterans day',\n 'victoria day',\n 'womens equality day',\n 'xmas',\n // Fixed religious and cultural holidays\n // Catholic + Christian\n 'epiphany',\n 'orthodox christmas day',\n 'orthodox new year',\n 'assumption of mary',\n 'all souls day',\n 'feast of the immaculate conception',\n 'feast of our lady of guadalupe',\n\n // Kwanzaa\n 'kwanzaa',\n // Pagan / metal 🤘\n 'imbolc',\n 'beltaine',\n 'lughnassadh',\n 'samhain',\n 'martin luther king day',\n 'mlk day',\n 'presidents day',\n 'mardi gras',\n 'tax day',\n 'commonwealth day',\n 'mothers day',\n 'memorial day',\n 'fathers day',\n 'columbus day',\n 'indigenous peoples day',\n 'canadian thanksgiving',\n 'election day',\n 'thanksgiving',\n 't-day',\n 'turkey day',\n 'black friday',\n 'cyber monday',\n // Astronomical religious and cultural holidays\n 'ash wednesday',\n 'palm sunday',\n 'maundy thursday',\n 'good friday',\n 'holy saturday',\n 'easter',\n 'easter sunday',\n 'easter monday',\n 'orthodox good friday',\n 'orthodox holy saturday',\n 'orthodox easter',\n 'orthodox easter monday',\n 'ascension day',\n 'pentecost',\n 'whitsunday',\n 'whit sunday',\n 'whit monday',\n 'trinity sunday',\n 'corpus christi',\n 'advent',\n // Jewish\n 'tu bishvat',\n 'tu bshevat',\n 'purim',\n 'passover',\n 'yom hashoah',\n 'lag baomer',\n 'shavuot',\n 'tisha bav',\n 'rosh hashana',\n 'yom kippur',\n 'sukkot',\n 'shmini atzeret',\n 'simchat torah',\n 'chanukah',\n 'hanukkah',\n // Muslim\n 'isra and miraj',\n 'lailat al-qadr',\n 'eid al-fitr',\n 'id al-Fitr',\n 'eid ul-Fitr',\n 'ramadan',\n 'eid al-adha',\n 'muharram',\n 'the prophets birthday',\n 'ostara',\n 'march equinox',\n 'vernal equinox',\n 'litha',\n 'june solistice',\n 'summer solistice',\n 'mabon',\n 'september equinox',\n 'fall equinox',\n 'autumnal equinox',\n 'yule',\n 'december solstice',\n 'winter solstice',\n // Additional important holidays\n 'chinese new year',\n 'diwali',\n]\n","module.exports = [\n 'noon',\n 'midnight',\n 'morning',\n 'tonight',\n 'evening',\n 'afternoon',\n 'breakfast time',\n 'lunchtime',\n 'dinnertime',\n 'midday',\n 'eod',\n 'oclock',\n 'oclock',\n 'at night',\n // 'now',\n // 'night',\n // 'sometime',\n // 'all day',\n]\n","const timezones = require('../_timezones')\nconst data = [\n [require('./dates'), '#Date'],\n [require('./durations'), '#Duration'],\n [require('./holidays'), '#Holiday'],\n [require('./times'), '#Time'],\n [Object.keys(timezones), '#Timezone'],\n]\nlet lex = {\n 'a couple': 'Value',\n thur: 'WeekDay',\n}\ndata.forEach((a) => {\n for (let i = 0; i < a[0].length; i++) {\n lex[a[0][i]] = a[1]\n }\n})\n\nmodule.exports = lex\n","const spacetime = require('spacetime')\n\nclass Unit {\n constructor(input, unit, context) {\n this.unit = unit || 'day'\n context = context || {}\n let today = {}\n if (context.today) {\n today = {\n date: context.today.date(),\n month: context.today.month(),\n year: context.today.year(),\n }\n }\n // set it to the beginning of the given unit\n let d = spacetime(input, context.timezone, { today: today })\n\n // set to beginning?\n // if (d.isValid() && keepTime !== true) {\n // d = d.startOf(this.unit)\n // }\n Object.defineProperty(this, 'd', {\n enumerable: false,\n writable: true,\n value: d,\n })\n Object.defineProperty(this, 'context', {\n enumerable: false,\n writable: true,\n value: context,\n })\n }\n // make a new one\n clone() {\n let d = new Unit(this.d, this.unit, this.context)\n return d\n }\n log() {\n console.log('--')\n this.d.log()\n console.log('\\n')\n return this\n }\n applyShift(obj = {}) {\n Object.keys(obj).forEach((unit) => {\n this.d = this.d.add(obj[unit], unit)\n })\n return this\n }\n applyTime(str) {\n if (str) {\n this.d = this.d.time(str)\n } else {\n this.d = this.d.startOf('day') //zero-out time\n }\n return this\n }\n applyWeekDay(day) {\n if (day) {\n let epoch = this.d.epoch\n this.d = this.d.day(day)\n if (this.d.epoch < epoch) {\n this.d = this.d.add(1, 'week')\n }\n }\n return this\n }\n applyRel(rel) {\n if (rel === 'next') {\n return this.next()\n }\n if (rel === 'last' || rel === 'this-past') {\n // special 'this past' logic is handled in WeekDay\n return this.last()\n }\n return this\n }\n applySection(section) {\n if (section === 'start') {\n return this.start()\n }\n if (section === 'end') {\n return this.end()\n }\n if (section === 'middle') {\n return this.middle()\n }\n return this\n }\n format(fmt) {\n return this.d.format(fmt)\n }\n start() {\n this.d = this.d.startOf(this.unit)\n if (this.context.dayStart) {\n this.d = this.d.time(this.context.dayStart)\n }\n return this\n }\n end() {\n this.d = this.d.endOf(this.unit)\n if (this.context.dayEnd) {\n this.d = this.d.time(this.context.dayEnd)\n }\n return this\n }\n middle() {\n let diff = this.d.diff(this.d.endOf(this.unit))\n let minutes = Math.round(diff.minutes / 2)\n this.d = this.d.add(minutes, 'minutes')\n return this\n }\n // the millescond before\n before() {\n this.d = this.d.minus(1, this.unit)\n this.d = this.d.endOf(this.unit)\n if (this.context.dayEnd) {\n this.d = this.d.time(this.context.dayEnd)\n }\n return this\n }\n // 'after 2019'\n after() {\n this.d = this.d.add(1, this.unit)\n this.d = this.d.startOf(this.unit)\n return this\n }\n // tricky: 'next june' 'next tuesday'\n next() {\n this.d = this.d.add(1, this.unit)\n this.d = this.d.startOf(this.unit)\n return this\n }\n // tricky: 'last june' 'last tuesday'\n last() {\n this.d = this.d.minus(1, this.unit)\n this.d = this.d.startOf(this.unit)\n return this\n }\n}\nmodule.exports = Unit\n","const spacetime = require('spacetime')\nconst Unit = require('./Unit')\n\nclass Day extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'day'\n if (this.d.isValid()) {\n this.d = this.d.startOf('day')\n }\n }\n}\n\n// like 'feb 2'\nclass CalendarDate extends Day {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'day'\n if (this.d.isValid()) {\n this.d = this.d.startOf('day')\n }\n }\n next() {\n this.d = this.d.add(1, 'year')\n return this\n }\n last() {\n this.d = this.d.minus(1, 'year')\n return this\n }\n}\n\nclass WeekDay extends Day {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'week'\n // is the input just a weekday?\n if (typeof input === 'string') {\n this.d = spacetime(context.today, context.timezone)\n this.d = this.d.day(input)\n // assume a wednesday in the future\n if (this.d.isBefore(context.today)) {\n this.d = this.d.add(7, 'days')\n }\n } else {\n this.d = input\n }\n this.weekDay = this.d.dayName()\n if (this.d.isValid()) {\n this.d = this.d.startOf('day')\n }\n }\n clone() {\n //overloaded method\n return new WeekDay(this.d, this.unit, this.context)\n }\n end() {\n //overloaded method\n this.d = this.d.endOf('day')\n if (this.context.dayEnd) {\n this.d = this.d.time(this.context.dayEnd)\n }\n return this\n }\n next() {\n this.d = this.d.add(7, 'days')\n this.d = this.d.day(this.weekDay)\n return this\n }\n last() {\n this.d = this.d.minus(7, 'days')\n this.d = this.d.day(this.weekDay)\n return this\n }\n // the millescond before\n before() {\n this.d = this.d.minus(1, 'day')\n this.d = this.d.endOf('day')\n if (this.context.dayEnd) {\n this.d = this.d.time(this.context.dayEnd)\n }\n return this\n }\n applyRel(rel) {\n if (rel === 'next') {\n let tooFar = this.context.today.endOf('week').add(1, 'week')\n this.next()\n // did we go too-far?\n if (this.d.isAfter(tooFar)) {\n this.last() // go back\n }\n return this\n }\n // the closest-one backwards\n if (rel === 'this-past') {\n return this.last()\n }\n if (rel === 'last') {\n let start = this.context.today.startOf('week')\n this.last()\n // are we still in 'this week' though?\n if (this.d.isBefore(start) === false) {\n this.last() // do it again\n }\n return this\n }\n return this\n }\n}\n\n// like 'haloween'\nclass Holiday extends CalendarDate {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'day'\n if (this.d.isValid()) {\n this.d = this.d.startOf('day')\n }\n }\n}\n\nmodule.exports = {\n Day: Day,\n WeekDay: WeekDay,\n CalendarDate: CalendarDate,\n Holiday: Holiday,\n}\n","const Unit = require('./Unit')\n\n// a specific month, like 'March'\nclass AnyMonth extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'month'\n // set to beginning\n if (this.d.isValid()) {\n this.d = this.d.startOf(this.unit)\n }\n }\n}\n\n// a specific month, like 'March'\nclass Month extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'month'\n // set to beginning\n if (this.d.isValid()) {\n this.d = this.d.startOf(this.unit)\n }\n }\n next() {\n this.d = this.d.add(1, 'year')\n this.d = this.d.startOf('month')\n return this\n }\n last() {\n this.d = this.d.minus(1, 'year')\n this.d = this.d.startOf('month')\n return this\n }\n}\nclass AnyQuarter extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'quarter'\n // set to beginning\n if (this.d.isValid()) {\n this.d = this.d.startOf(this.unit)\n }\n }\n last() {\n this.d = this.d.minus(1, 'quarter')\n this.d = this.d.startOf(this.unit)\n return this\n }\n}\n\nclass Quarter extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'quarter'\n // set to beginning\n if (this.d.isValid()) {\n this.d = this.d.startOf(this.unit)\n }\n }\n next() {\n this.d = this.d.add(1, 'year')\n this.d = this.d.startOf(this.unit)\n return this\n }\n last() {\n this.d = this.d.minus(1, 'year')\n this.d = this.d.startOf(this.unit)\n return this\n }\n}\nclass Season extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'season'\n // set to beginning\n if (this.d.isValid()) {\n this.d = this.d.startOf(this.unit)\n }\n }\n next() {\n this.d = this.d.add(1, 'year')\n this.d = this.d.startOf(this.unit)\n return this\n }\n last() {\n this.d = this.d.minus(1, 'year')\n this.d = this.d.startOf(this.unit)\n return this\n }\n}\nclass Year extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'year'\n if (this.d.isValid()) {\n this.d = this.d.startOf('year')\n }\n }\n}\n\nmodule.exports = {\n AnyMonth: AnyMonth,\n Month: Month,\n Quarter: Quarter,\n AnyQuarter: AnyQuarter,\n Season: Season,\n Year: Year,\n}\n","const Unit = require('./Unit')\n\nclass Week extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'week'\n if (this.d.isValid()) {\n this.d = this.d.startOf('week')\n }\n }\n}\n\n//may need some work\nclass WeekEnd extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context)\n this.unit = 'week'\n if (this.d.isValid()) {\n this.d = this.d.day('saturday')\n this.d = this.d.startOf('day')\n }\n }\n start() {\n this.d = this.d.day('saturday').startOf('day')\n return this\n }\n // end() {\n // this.d = this.d.day('sunday').endOf('day')\n // return this\n // }\n next() {\n this.d = this.d.add(1, this.unit)\n this.d = this.d.startOf('weekend')\n return this\n }\n last() {\n this.d = this.d.minus(1, this.unit)\n this.d = this.d.startOf('weekend')\n return this\n }\n}\n\nmodule.exports = {\n Week: Week,\n WeekEnd: WeekEnd,\n}\n","const Unit = require('./Unit')\n\nclass Hour extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context, true)\n this.unit = 'hour'\n if (this.d.isValid()) {\n this.d = this.d.startOf('hour')\n }\n }\n}\nclass Minute extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context, true)\n this.unit = 'minute'\n if (this.d.isValid()) {\n this.d = this.d.startOf('minute')\n }\n }\n}\nclass Moment extends Unit {\n constructor(input, unit, context) {\n super(input, unit, context, true)\n this.unit = 'millisecond'\n }\n}\n\nmodule.exports = {\n Hour: Hour,\n Minute: Minute,\n Moment: Moment,\n}\n","module.exports = Object.assign(\n { Unit: require('./Unit') },\n require('./_day'),\n require('./_year'),\n require('./_week'),\n require('./_time')\n)\n","const knownUnits = {\n second: true,\n minute: true,\n hour: true,\n day: true,\n week: true,\n weekend: true,\n month: true,\n season: true,\n quarter: true,\n year: true,\n}\n\nconst aliases = {\n wk: 'week',\n min: 'minute',\n sec: 'second',\n weekend: 'week', //for now...\n}\n\nconst parseUnit = function (m) {\n let unit = m.match('#Duration').text('normal')\n unit = unit.replace(/s$/, '')\n // support shorthands like 'min'\n if (aliases.hasOwnProperty(unit)) {\n unit = aliases[unit]\n }\n return unit\n}\n\n//turn '5 weeks before' to {weeks:5}\nconst parseShift = function (doc) {\n let result = {}\n let shift = doc.match('#DateShift+')\n if (shift.found === false) {\n return result\n }\n // '5 weeks'\n shift.match('#Cardinal #Duration').forEach((ts) => {\n let num = ts.match('#Cardinal').text('normal')\n num = parseFloat(num)\n if (num && typeof num === 'number') {\n let unit = parseUnit(ts)\n if (knownUnits[unit] === true) {\n result[unit] = num\n }\n }\n })\n //is it 2 weeks ago? → -2\n if (shift.has('(before|ago|hence|back)$') === true) {\n Object.keys(result).forEach((k) => (result[k] *= -1))\n }\n shift.remove('#Cardinal #Duration')\n // supoprt '1 day after tomorrow'\n let m = shift.match('[#Duration] [(after|before)]')\n if (m.found) {\n let unit = m.groups('unit').text('reduced')\n // unit = unit.replace(/s$/, '')\n let dir = m.groups('dir').text('reduced')\n if (dir === 'after') {\n result[unit] = 1\n } else if (dir === 'before') {\n result[unit] = -1\n }\n }\n // in half an hour\n m = shift.match('half (a|an) [#Duration]', 0)\n if (m.found) {\n let unit = parseUnit(m)\n result[unit] = 0.5\n }\n // finally, remove it from our text\n doc.remove('#DateShift')\n return result\n}\nmodule.exports = parseShift\n","/*\na 'counter' is a Unit determined after a point\n * first hour of x\n * 7th week in x\n * last year in x\n * \nunlike a shift, like \"2 weeks after x\"\n*/\nconst oneBased = {\n minute: true,\n}\nconst getCounter = function (doc) {\n // 7th week of\n let m = doc.match('[#Value] [#Duration+] (of|in)')\n if (m.found) {\n let obj = m.groups()\n let num = obj.num.text('reduced')\n let unit = obj.unit.text('reduced')\n let found = {\n unit: unit,\n num: Number(num) || 0,\n }\n // 0-based or 1-based units\n if (!oneBased[unit]) {\n found.num -= 1\n }\n doc = doc.remove(m)\n return found\n }\n // first week of\n m = doc.match('[(first|initial|last|final)] [#Duration+] (of|in)')\n if (m.found) {\n let obj = m.groups()\n let dir = obj.dir.text('reduced')\n let unit = obj.unit.text('reduced')\n if (dir === 'initial') {\n dir = 'first'\n }\n if (dir === 'final') {\n dir = 'last'\n }\n let found = {\n unit: unit,\n dir: dir,\n }\n doc = doc.remove(m)\n return found\n }\n\n return {}\n}\nmodule.exports = getCounter\n","const spacetime = require('spacetime')\n\nconst hardCoded = {\n daybreak: '7:00am', //ergh\n breakfast: '8:00am',\n morning: '9:00am',\n noon: '12:00pm',\n midday: '12:00pm',\n afternoon: '2:00pm',\n lunchtime: '12:00pm',\n evening: '6:00pm',\n dinnertime: '6:00pm',\n night: '8:00pm',\n eod: '10:00pm',\n midnight: '12:00am',\n}\n\nconst halfPast = function (m, s) {\n let hour = m.match('#Cardinal$').text('reduced')\n\n let term = m.match('(half|quarter|25|15|10|5)')\n let mins = term.text('reduced')\n if (term.has('half')) {\n mins = '30'\n }\n if (term.has('quarter')) {\n mins = '15'\n }\n let behind = m.has('to')\n // apply it\n s = s.hour(hour)\n s = s.startOf('hour')\n // assume 'half past 5' is 5pm\n if (hour < 6) {\n s = s.ampm('pm')\n }\n if (behind) {\n s = s.subtract(mins, 'minutes')\n } else {\n s = s.add(mins, 'minutes')\n }\n return s\n}\n\nconst parseTime = function (doc, context) {\n let time = doc.match('(at|by|for|before|this)? #Time+')\n if (time.found) {\n doc.remove(time)\n }\n // get the main part of the time\n time = time.not('^(at|by|for|before|this)')\n time = time.not('sharp')\n time = time.not('on the dot')\n let s = spacetime.now(context.timezone)\n let now = s.clone()\n\n // check for known-times (like 'today')\n let timeStr = time.text('reduced')\n if (hardCoded.hasOwnProperty(timeStr)) {\n return hardCoded[timeStr]\n }\n\n // '5 oclock'\n let m = time.match('^#Cardinal oclock (am|pm)?')\n if (m.found) {\n m = m.not('oclock')\n s = s.hour(m.text('reduced'))\n s = s.startOf('hour')\n if (s.isValid() && !s.isEqual(now)) {\n let ampm = m.match('(am|pm)').text('reduced')\n s = s.ampm(ampm)\n return s.time()\n }\n }\n\n // 'quarter to two'\n m = time.match('(half|quarter|25|15|10|5) (past|after|to) #Cardinal')\n if (m.found) {\n s = halfPast(m, s)\n if (s.isValid() && !s.isEqual(now)) {\n return s.time()\n }\n }\n // '4 in the evening'\n m = time.match('[