import test from 'tape' import nlp from './_lib.js' import spacetime from 'spacetime' //number of days between start+end const tests = [ { today: [2016, 7, 13], //aug 13th (saturday) tests: [ //days ['today', 'today, Sat Aug 13th'], ['yesterday', 'yesterday, Fri Aug 12th'], ['tomorrow', 'tomorrow, Sun Aug 14th'], ['september 5th', 'on Mon, Sept 5th'], ['december seven', 'on Wed, Dec 7th'], ['december seventh', 'on Wed, Dec 7th'], ['december 14', 'on Wed, Dec 14th'], ['december 14th', 'on Wed, Dec 14th'], ['january 5th', 'on Thurs, Jan 5th, 2017'], ['on april fools', 'on Sat, Apr 1st, 2017'], ['next weekend', 'Aug 20th-21st'], ['last weekend', 'Aug 6th-7th'], ['next week', 'Aug 15th-21st'], ['this month', 'Aug 1st-31st'], ['sometime this month', 'Aug 1st-31st'], ['next month', 'Sept 1st-30th'], ['last month', 'Jul 1st-31st 2016'], ['in february', 'Feb 1-28, 2017'], // ['in 2018', 'Jan 1 - Dec 31, 2018'], ['before 2017', 'by Sun, Jan 1st, 2017'], ['by february', 'by Wed, Feb 1st, 2017'], ['by tomorrow', 'today, Sat Aug 13th'], //!! ['by september 5th', 'by Mon, Sept 5th'], // ['by next weekend', 'by Sat, Aug 20th'], ['before christmas', 'by Sun, Dec 25th'], // ['after christmas', 'Dec 25th 2016 - Jan 8th 2017'], // ['sometime after next week', 'Aug 19th - Sept 2nd 2016'], // ['after next weekend', 'Aug 21st - Sept 4th 2016'], ['september 5th 2018', 'on Wed, Sept 5th, 2018'], ['on april fools 2020', 'on Wed, Apr 1st, 2020'], ['june 5-7 1999', 'Jun 5-7, 1999'], ['june 5 to 7, 1999', 'Jun 5-7, 1999'], ['june 5th to 7, 1999', 'Jun 5-7, 1999'], ['june 5th-7th 2017', 'Jun 5-7, 2017'], // ['5th to 7 june, 1999', 'Jun 5-7, 1999'], // ['5 to 7 august 1999', 'Aug 5-7, 1999'], // ['15 to 20 of august 1999', 'Aug 15-20, 1999'], ['15th - 20th of august', 'Aug 15-20'], ['28th of September to 5th of October 2008', 'Sep 28 - Oct 5, 2008'], ['1st of March to 15th of March 1999', 'Mar 1-15, 1999'], ['15th of August to 20th of August 2016', 'Aug 15-20, 2016'], ['31st of December to 2nd of January 2000', 'Dec 31, 2000 - Jan 2, 2001'], ['28th of september through 5th of october 2008', 'Sep 28 - Oct 5, 2008'], ['monday to wednesday', 'Aug 15th to Aug 17th'], ['this weekend', 'Aug 13th-14th'], ['this week', 'Aug 8th-14th'], ['last week', 'Aug 1st-7th'], ['this year', 'Jan 1st - Dec 31st, 2016'], ['next year', 'Jan 1st - Dec 31st, 2017'], ['last year', 'Jan 1st - Dec 31st, 2015'], ['in 3 days', 'Tues, Aug 16th'], ['in 2 weeks', 'Aug 27th'], ['two weeks from now', 'Aug 27th'], ['halloween', 'on Mon, Oct 31st'], ['christmas', 'on Sun, Dec 25th'], ['christmas eve', 'on Sat, Dec 24th'], ['thanksgiving', 'on Thurs, Nov 24th'], ['valentines day', 'on Sun, Feb 14th, 2017'], ['independence day', 'on Mon, Jul 4th, 2017'], ['easter', 'on Sun, Apr 16th, 2017'], ['new years', 'on Sun, Jan 1st, 2017'], ['new years eve', 'on Sat, Dec 31st'], ['black friday', 'on Fri, Nov 25th'], ['mothers day', 'on Sun, May 14th, 2017'], ['fathers day', 'on Sun, Jun 18th, 2017'], ['two days before christmas', 'on Fri, Dec 23rd'], ['a week after thanksgiving', 'Dec 1st'], ['august 20th', 'on Sat, Aug 20th'], ['on the 20th', 'on Sat, Aug 20th'], ['monday', 'on Mon, Aug 15th'], ['next monday', 'on Mon, Aug 15th'], ['last monday', 'on Mon, Aug 1st'], ['this monday', 'on Mon, Aug 15th'], ['q4', 'Oct 1st - Dec 31st'], ['q4 2016', 'Oct 1st - Dec 31st, 2016'], ['first quarter 2017', 'Jan 1st - Mar 31st, 2017'], ['spring 2017', 'Mar 1st - Apr 30th, 2017'], ['summer 2016', 'Jun 1st - Jul 31st'], ['fall 2016', 'Sep 1st - Oct 31st'], ['august', 'Aug 1st-31st'], ['this august', 'Aug 1st-31st'], ['next august', 'Aug 1st-31st, 2017'], ['september', 'Sept 1st-30th'], ['this september', 'Sept 1st-30th'], ['october 1st to 3rd', 'Oct 1-3'], ['aug 10 to 15', 'Aug 10-15'], ['august 10th to 15th', 'Aug 10-15'], ['from monday to friday', 'Aug 15th to Aug 19th'], ['monday through friday', 'Aug 15th to Aug 19th'], ['sometime next week', 'Aug 15th-21st'], ['by next month', 'by Thurs, Sept 1st'], ['cinco de mayo', 'on Thu, May 5th, 2017'], ['juneteenth', 'on Mon, Jun 19th, 2017'], ['groundhog day', 'on Thu, Feb 2nd, 2017'], ['presidents day', 'on Mon, Feb 20th, 2017'], ['veterans day', 'on Fri, Nov 11th'], ['boxing day', 'on Mon, Dec 26th'], ['st patricks day', 'on Fri, Mar 17th, 2017'], ['april fools', 'on Sat, Apr 1st, 2017'], ['in 10 days', 'on Sat, Aug 23rd'], ['in 1 week', 'on Sat, Aug 20th'], ['a week from now', 'on Sat, Aug 20th'], ['three days from now', 'on Tues, Aug 16th'], ['next friday', 'on Fri, Aug 19th'], ['this friday', 'on Fri, Aug 19th'], ['last friday', 'on Fri, Aug 5th'], ['next tuesday', 'on Tues, Aug 16th'], ['this tuesday', 'on Tues, Aug 16th'], ['sunday', 'on Sun, Aug 14th'], ['saturday', 'on Sat, Aug 13th'], ['q1 2017', 'Jan 1st - Mar 31st, 2017'], ['q2 2017', 'Apr 1st - Jun 30th, 2017'], ['q3 2016', 'Jul 1st - Sep 30th, 2016'], ['second quarter 2017', 'Apr 1st - Jun 30th, 2017'], ['third quarter 2016', 'Jul 1st - Sep 30th, 2016'], ['first week of september', 'Aug 29th - Sept 4th'], ['second week of august', 'Aug 8th-14th'], ['by christmas', 'by Sun, Dec 25th'], ['by next week', 'by Mon, Aug 15th'], ['sometime tomorrow', 'tomorrow, Sun Aug 14th'], ['sometime next weekend', 'Aug 20th-21st'], ['july 4th', 'on Mon, Jul 4th, 2017'], ['march 15th 2018', 'on Thurs, Mar 15th, 2018'], ['15th of march 2018', 'on Thurs, Mar 15th, 2018'], ['from august 1st to 5th', 'Aug 1-5'], ['august 1 to august 5', 'Aug 1-5'], ['this past monday', 'on Mon, Aug 8th'], ['this past friday', 'on Fri, Aug 12th'], ['this past weekend', 'Aug 6th-7th'], ['this coming monday', 'on Mon, Aug 15th'], ['this upcoming tuesday', 'on Tues, Aug 16th'], ['next thursday', 'on Thurs, Aug 18th'], ['this thursday', 'on Thurs, Aug 18th'], ['next saturday', 'on Sat, Aug 20th'], ['last saturday', 'on Sat, Aug 6th'], ['this saturday', 'on Sat, Aug 13th'], ['next sunday', 'on Sun, Aug 21st'], ['last sunday', 'on Sun, Aug 7th'], ['this sunday', 'on Sun, Aug 14th'], ['in 14 days', 'on Sat, Aug 27th'], ['in 21 days', 'on Sat, Sep 3rd'], ['in 30 days', 'on Mon, Sep 12th'], ['in 6 weeks', 'on Sat, Sep 24th'], ['in 6 months', 'on Mon, Feb 13th, 2017'], ['in 1 year', 'on Sun, Aug 13th, 2017'], ['3 days ago', 'on Wed, Aug 10th'], ['5 days ago', 'on Mon, Aug 8th'], ['1 week ago', 'on Sat, Aug 6th'], ['2 weeks ago', 'on Sat, Jul 30th'], ['1 month ago', 'on Wed, Jul 13th'], ['october', 'Oct 1st-31st'], ['this october', 'Oct 1st-31st'], ['next october', 'Oct 1st-31st, 2017'], ['november', 'Nov 1st-30th'], ['this november', 'Nov 1st-30th'], ['december', 'Dec 1st-31st'], ['this december', 'Dec 1st-31st'], ['january', 'Jan 1st-31st, 2017'], ['this january', 'Jan 1st-31st, 2017'], ['february', 'Feb 1-28, 2017'], ['this february', 'Feb 1-28, 2017'], ['march', 'Mar 1st-31st, 2017'], ['this march', 'Mar 1st-31st, 2017'], ['april', 'Apr 1st-30th, 2017'], ['this april', 'Apr 1st-30th, 2017'], ['may', 'May 1st-31st, 2017'], ['this may', 'May 1st-31st, 2017'], ['june', 'Jun 1st-30th, 2017'], ['this june', 'Jun 1st-30th, 2017'], ['july', 'Jul 1st-31st, 2017'], ['this july', 'Jul 1st-31st, 2017'], ['tax day', 'on Sat, Apr 15th, 2017'], ['mardi gras', 'on Tue, Feb 28th, 2017'], ['armistice day', 'on Fri, Nov 11th'], ['bastille day', 'on Fri, Jul 14th, 2017'], ['canada day', 'on Sat, Jul 1st, 2017'], ['victoria day', 'on Mon, May 24th, 2017'], ['epiphany', 'on Fri, Jan 6th, 2017'], ['kwanzaa', 'on Mon, Dec 26th'], ['all saints day', 'on Tue, Nov 1st'], ['all hallows eve', 'on Mon, Oct 31st'], ['saint valentines day', 'on Sun, Feb 14th, 2017'], ['mlk day', 'on Mon, Jan 16th, 2017'], ['one week before christmas', 'on Sun, Dec 18th'], ['three days before new years', 'on Thu, Dec 29th'], ['two days after easter', 'on Tue, Apr 18th, 2017'], ['a week after easter', 'on Sun, Apr 23rd, 2017'], ['second quarter 2016', 'Apr 1st - Jun 30th, 2016'], ['fourth quarter', 'Oct 1st - Dec 31st, 2016'], ['spring 2016', 'Mar 1st - Apr 30th, 2016'], ['third week of august', 'Aug 15th-21st'], ['fourth week of august', 'Aug 22nd-28th'], ['first week of october', 'Sept 26th - Oct 2nd'], ['second week of october', 'Oct 3rd-9th'], ['third week of november', 'Nov 14th-20th'], ['sept 1 to 3', 'Sept 1-3'], ['september 1st to 3rd', 'Sept 1-3'], ['aug 1-3', 'Aug 1-3'], ['august 1-3', 'Aug 1-3'], ['tuesday to thursday', 'Aug 16th to Aug 18th'], ['from tuesday to thursday', 'Aug 16th to Aug 18th'], ['sometime this week', 'Aug 8th-14th'], ['sometime next month', 'Sept 1st-30th'], ['by august 20th', 'by Sat, Aug 20th'], ['by next friday', 'by Fri, Aug 19th'], ['before tomorrow', 'today, Sat Aug 13th'], ['aug 13 2016', 'on Sat, Aug 13th'], ['13 august 2016', 'on Sat, Aug 13th'], ['august thirteenth', 'on Sat, Aug 13th'], ['the 13th of august', 'on Sat, Aug 13th'], ['2016-08-13', 'on Sat, Aug 13th'], ['08/13/2016', 'on Sat, Aug 13th'], ['feb 29 2016', 'on Mon, Feb 29th, 2016'], ['29 february 2016', 'on Mon, Feb 29th, 2016'], ], }, { today: [2016, 10, 23], //wed nov 23rd tests: [ ['this month', 'nov 1 to nov 30'], ['june twenty-first 1992', 'june 21 1992 - june 21 1992'], ['this august', 'aug 1 2017 to aug 31 2017'], ['the last weekend in october', 'Oct 28 to 29'], ['the last weekend in october 2017', 'Oct 28 to 29, 2017'], ['sometime tomorrow', 'Thu Nov 24th'], ['on april fools 2020', 'Wed, Apr 1st, 2020'], ['april fools at 5pm', 'Wed, Apr 1st, 2017 at 5:00pm'], ['on the 18th', 'Sun, Dec 18th'], ['this quarter', 'Oct 1st 2016 to Dec 31st 2016'], // ['this morning at 9', 'Nov 23rd @ 9am'], ['10 August 2012', 'Aug 10 2012'], ['Sunday, March 6, 2016', 'Mar 6 2016'], ['August 10 to 22, 2012', 'Aug 10 2012 to Aug 22 2012'], ['May eighth, 2010', 'May 8 2010'], ['May twenty-fourth, 2010', 'May 24 2010'], ['Sep 2012', 'Sep 1 2012 to Sep 30 2012'], ['Sept, 2012', 'Sep 1 2012 - Sep 30 2012'], ['Sep-2012', 'Sep 1 2012 to Sep 30 2012'], ['20/10/2012', 'Oct 20 2012'], ['8/10/2012 - 8/15/2012', 'Aug 10 2012 - Aug 15 2012'], ['05-25-2015', 'May 25 2015'], ['5 Days ago', 'Nov 18 2016 to Nov 18 2016'], ['Sunday 12/7/2014', 'Dec 7 2014 to Dec 7 2014'], ['two weeks from now', 'Dec 7 2016'], // ['two and a half weeks from now', 'Dec 11th 2016'], // ['two sundays from now', 'Dec 4th 2016'], // ['two mondays from now', 'Dec 5th 2016'], // ['second weekend in 2019', 'Jan 12 to Jan 13, 2019'], ['Jan 12 to Jan 13', 'Jan 12 2017 to Jan 13 2017'], ['Jan 22 2017 to Jan 13 2018', 'January 22 2017 to January 13 2018'], ['5 to 7 of january 1998', 'Jan 5th 1998 to Jan 7 1998'], ['january 5 to 7 1998', 'Jan 5th 1998, to Jan 7 1998'], ['third quarter 1998', 'july 1st 1998 to september 30th 1998'], // ['middle of q1 2019', 'feb 12 2019'], ['third day of 2019', 'jan 3rd 2019'], ['third week of 2019', 'jan 14th to 20th 2019'], ['third month of 2019', 'march 1 2019 to march 31th 2019'], ['first weekend of 2019', 'january 5 2019 to jan 6th 2019'], // ['the last week in 2019', 'dec 23rd 2019 to dec 29'], // ['the first quarter in 2019', 'january 1st to march 31st 2019'], // // ['the last quarter in 2019', 'october 1st to december 30th 2019'], // ['last spring', 'march 1st 2015 to may 31st 2015'], // ['this spring', 'march 1st 2016 to may 31st 2016'], // ['next spring', 'march 1st 2017 to may 31st 2017'], ['the first week of june', 'May 29th 2017 to June 4th 2017'], ['22-23 Feb at 7pm', 'Feb 22 2017 7pm until Feb 23 2017'], // ['22-23 Feb 2016 at 7pm', 'Feb 22 2016 to Feb 23 2016'], ['Tuesday, 10 January', 'Jan 10 2017'], ['Monday - Wednesday', 'Nov 28 - Nov 30'], ['today to next friday', 'Nov 23 to Dec 2'], // ['middle of q1 1998', 'Feb 12 1998'], // ['within two weeks', 'Nov 23 to Dec 8'], // ['within a month', 'Nov 23 - Dec 23'], // ['within a few months', 'Nov 23 - Jan 23 2017'], // ['1994-11-05T13:15:000Z', 'Nov 5 1994 1:15pm'], ['August 10 to 22, 2012', 'Aug 10 2012 to Aug 22 2012'], ['August 10-22, 2012', 'Aug 10 2012 to Aug 22 2012'], // ['August 10 - November 12', 'Aug 10 2017 - Nov 12 2017'], //tricky // ['August 10 - January 12', 'Aug 10 2017 - Jan 12 2018'], //tricky ['May eighth to tenth, 2010', 'May 8 2010 to May 10 2010'], // ['04/2016', 'Apr 4 2016'], ['Tuesday 20/3/2015', 'march 20 2015'], ['2015.08.13', 'Aug 13 2015'], // ['this past mon', 'nov 21'], // ['two mondays from now', 'dec 5 - dec 5'], // ['2018 after june', 'jun 1 2018 - jun 15 2018'], ['fourth quarter, 2002', 'oct 1 2002 thru dec 31 2002'], ['thanksgiving 2018', 'nov 22 2018'], ['today', 'Thu Nov 23rd'], ['yesterday', 'Wed Nov 22nd'], ['tomorrow', 'Fri Nov 24th'], ['next week', 'Nov 28 to Dec 4'], ['last week', 'Nov 14 to Nov 20'], ['this weekend', 'Nov 26 to Nov 27'], ['next weekend', 'Dec 3 to Dec 4'], ['halloween', 'Oct 31 2016'], ['christmas', 'Dec 25 2016'], ['thanksgiving', 'Nov 24 2016'], ['in 5 days', 'Nov 28 2016'], ['in 2 weeks', 'Dec 7 2016'], ['in 3 months', 'Feb 23 2017'], ['q1 2017', 'jan 1 2017 to mar 31 2017'], ['q2 2017', 'apr 1 2017 to jun 30 2017'], ['spring 2017', 'march 1 2017 to april 30 2017'], ['summer 2017', 'june 1 2017 to july 31 2017'], ['winter 2016', 'dec 1 2016 to jan 31 2017'], ['fall 2016', 'sep 1 2016 to oct 31 2016'], ['autumn 2016', 'sep 1 2016 to oct 31 2016'], ['january 1st', 'jan 1 2017'], ['december 25th', 'dec 25 2016'], ['nov 5th to 7th', 'Nov 5 2016 to Nov 7 2016'], ['november 5 to 7', 'Nov 5 2016 to Nov 7 2016'], ['monday to friday', 'Nov 28 to Dec 2'], ['next quarter', 'Jan 1st 2017 to Mar 31st 2017'], ['first week of december', 'Nov 28 2016 to Dec 4 2016'], ['second week of january 2017', 'Jan 2 2017 to Jan 8 2017'], ['canadian thanksgiving 2016', 'Oct 9 2016'], ['this year', 'jan 1 2016 to dec 31 2016'], ['next year', 'jan 1 2017 to dec 31 2017'], ['last year', 'jan 1 2015 to dec 31 2015'], ['next month', 'dec 1 to dec 31'], ['last month', 'oct 1 to oct 31'], ['in 1 week', 'Nov 30 2016'], ['a week from now', 'Nov 30 2016'], ['three weeks from now', 'Dec 14 2016'], ['six months from now', 'May 23 2017'], ['a year from now', 'Nov 23 2017'], ['cinco de mayo 2017', 'may 5 2017'], ['independence day 2017', 'jul 4 2017'], ['halloween 2016', 'Oct 31 2016'], ['xmas', 'Dec 25 2016'], ['christmas eve', 'Dec 24 2016'], ['new years', 'jan 1 2017'], ['new years day 2017', 'jan 1 2017'], ['feb 14 2017', 'feb 14 2017'], ['march 20 2015', 'march 20 2015'], ['dec 1 to dec 25 2016', 'Dec 1 2016 to Dec 25 2016'], ['nov 23 to nov 30', 'Nov 23 2016 to Nov 30 2016'], ['from nov 23 to dec 1', 'Nov 23 2016 to Dec 1 2016'], ['wednesday to friday', 'Nov 23 to Nov 25'], ['this wednesday', 'Nov 23 2016'], ['next wednesday', 'Nov 30 2016'], ['last wednesday', 'Nov 16 2016'], ['fourth quarter 2016', 'oct 1 2016 thru dec 31 2016'], ['q3 2016', 'jul 1 2016 to sep 30 2016'], ['q4 2016', 'oct 1 2016 to dec 31 2016'], ['pentecost 2017', 'jun 4 2017'], ['ash wednesday 2017', 'mar 1 2017'], ['black friday 2016', 'Nov 25 2016'], ['new years eve', 'Dec 31 2016'], ['easter 2017', 'apr 16 2017'], ['good friday 2017', 'apr 14 2017'], ['valentines day 2017', 'feb 14 2017'], ['presidents day 2017', 'feb 20 2017'], ['mlk day 2017', 'jan 16 2017'], ['this past monday', 'Nov 21 2016'], ['this past friday', 'Nov 18 2016'], ['this past weekend', 'Nov 19 2016 to Nov 20 2016'], ['this upcoming monday', 'Nov 28 2016'], ['last tuesday', 'Nov 15 2016'], ['next thursday', 'Dec 1 2016'], ['last thursday', 'Nov 17 2016'], ['next saturday', 'Dec 3 2016'], ['last saturday', 'Nov 19 2016'], ['this saturday', 'Nov 26 2016'], ['next sunday', 'Dec 4 2016'], ['last sunday', 'Nov 20 2016'], ['this sunday', 'Nov 27 2016'], ['in 14 days', 'Dec 7 2016'], ['in 21 days', 'Dec 14 2016'], ['in 30 days', 'Dec 23 2016'], ['in 6 weeks', 'Jan 4 2017'], ['in 1 year', 'Nov 23 2017'], ['3 days ago', 'Nov 20 2016'], ['7 days ago', 'Nov 16 2016'], ['14 days ago', 'Nov 9 2016'], ['30 days ago', 'Oct 24 2016'], ['2 months ago', 'Sep 23 2016'], ['6 months ago', 'May 23 2016'], ['1 year ago', 'Nov 23 2015'], ['last quarter', 'Jul 1st 2016 to Sep 30th 2016'], ['second quarter 2016', 'apr 1 2016 to jun 30 2016'], ['third quarter 2017', 'jul 1 2017 to sep 30 2017'], ['december', 'dec 1 to dec 31'], ['this december', 'dec 1 to dec 31'], ['january', 'jan 1 2017 to jan 31 2017'], ['this january', 'jan 1 2017 to jan 31 2017'], ['february', 'feb 1 2017 to feb 28 2017'], ['this february', 'feb 1 2017 to feb 28 2017'], ['march', 'march 1 2017 to march 31 2017'], ['this march', 'march 1 2017 to march 31 2017'], ['april', 'april 1 2017 to april 30 2017'], ['this april', 'april 1 2017 to april 30 2017'], ['may', 'may 1 2017 to may 31 2017'], ['this may', 'may 1 2017 to may 31 2017'], ['june', 'june 1 2017 to june 30 2017'], ['this june', 'june 1 2017 to june 30 2017'], ['july', 'july 1 2017 to july 31 2017'], ['this july', 'july 1 2017 to july 31 2017'], ['october', 'oct 1 2016 to oct 31 2016'], ['this october', 'oct 1 2016 to oct 31 2016'], ['bastille day 2017', 'jul 14 2017'], ['canada day 2017', 'jul 1 2017'], ['groundhog day 2017', 'feb 2 2017'], ['one week before christmas', 'dec 18 2016'], ['three days before new years', 'dec 29 2016'], ['two weeks after thanksgiving', 'dec 8 2016'], ['third week of november', 'nov 14 2016 to nov 20 2016'], ['fourth week of november', 'nov 21 2016 to nov 27 2016'], ['dec 5 to 10', 'Dec 5 2016 to Dec 10 2016'], ['december 5th to 10th', 'Dec 5 2016 to Dec 10 2016'], ['nov 1 to 5', 'Nov 1 2016 to Nov 5 2016'], ['november 1st to 5th', 'Nov 1 2016 to Nov 5 2016'], ['tuesday to thursday', 'Nov 29 to Dec 1'], ['from monday to wednesday', 'Nov 28 to Nov 30'], ['sometime this week', 'Nov 21 2016 to Nov 27 2016'], ['by december 25th', 'by Dec 25 2016'], ['by next friday', 'by Dec 2 2016'], ['nov 23 2016', 'Nov 23 2016'], ['23 november 2016', 'Nov 23 2016'], ['november twenty third', 'Nov 23 2016'], ['the 23rd of november', 'Nov 23 2016'], ['2016-11-23', 'Nov 23 2016'], ['11/23/2016', 'Nov 23 2016'], ['in march', 'march 1 2017 to march 31 2017'], ['two days from now', 'Nov 25 2016'], ['four weeks from now', 'Dec 21 2016'], ['five months from now', 'Apr 23 2017'], ['nine months from now', 'Aug 23 2017'], ], }, { today: [2017, 0, 1], //jan 1st 2017 tests: [ ['this month', 'jan 1 2017 to jan 31 2017'], ['next month', 'feb 1 2017 to feb 28 2017'], ['last month', 'dec 1 2016 to dec 31 2016'], ['this week', 'dec 26 2016 to jan 1 2017'], ['next week', 'jan 2 2017 to jan 8 2017'], ['this year', 'jan 1 2017 to dec 31 2017'], ['next year', 'jan 1 2018 to dec 31 2018'], ['last year', 'jan 1 2016 to dec 31 2016'], ['this weekend', 'jan 7 2017 to jan 8 2017'], ['next weekend', 'jan 14 2017 to jan 15 2017'], ['q1', 'jan 1 2017 to mar 31 2017'], ['q1 2017', 'jan 1 2017 to mar 31 2017'], ['first quarter', 'jan 1 2017 to mar 31 2017'], ['q2 2017', 'apr 1 2017 to jun 30 2017'], ['q3 2017', 'jul 1 2017 to sep 30 2017'], ['q4 2017', 'oct 1 2017 to dec 31 2017'], ['spring 2017', 'march 1 2017 to april 30 2017'], ['summer 2017', 'june 1 2017 to july 31 2017'], ['fall 2017', 'sep 1 2017 to oct 31 2017'], ['winter 2017', 'dec 1 2017 to jan 31 2018'], ['today', 'Sun Jan 1st 2017'], ['tomorrow', 'Mon Jan 2nd 2017'], ['january 15th', 'jan 15 2017'], ['in february', 'feb 1 2017 to feb 28 2017'], ['by march', 'by Wed, Mar 1st, 2017'], ['in 3 days', 'jan 4 2017'], ['in 2 weeks', 'jan 15 2017'], ['two weeks from now', 'jan 15 2017'], ['by february', 'by Wed, Feb 1st, 2017'], ['by next month', 'by Wed, Feb 1st, 2017'], ['christmas 2017', 'dec 25 2017'], ['thanksgiving 2017', 'nov 23 2017'], ['this past monday', 'dec 26 2016'], ['this past friday', 'dec 30 2016'], ['this past weekend', 'dec 31 2016 to jan 1 2017'], ['this coming friday', 'jan 6 2017'], ['this upcoming monday', 'jan 2 2017'], ['next thursday', 'jan 5 2017'], ['this thursday', 'jan 5 2017'], ['next saturday', 'jan 7 2017'], ['this saturday', 'jan 7 2017'], ['next sunday', 'jan 8 2017'], ['in 7 days', 'jan 8 2017'], ['in 14 days', 'jan 15 2017'], ['in 21 days', 'jan 22 2017'], ['in 30 days', 'jan 31 2017'], ['in 6 weeks', 'feb 12 2017'], ['in 6 months', 'jul 1 2017'], ['in 1 year', 'jan 1 2018'], ['3 days ago', 'dec 29 2016'], ['5 days ago', 'dec 27 2016'], ['1 week ago', 'dec 25 2016'], ['2 weeks ago', 'dec 18 2016'], ['1 month ago', 'dec 1 2016'], ['february', 'feb 1 2017 to feb 28 2017'], ['march', 'march 1 2017 to march 31 2017'], ['april', 'april 1 2017 to april 30 2017'], ['may', 'may 1 2017 to may 31 2017'], ['june', 'june 1 2017 to june 30 2017'], ['july', 'july 1 2017 to july 31 2017'], ['october', 'oct 1 2017 to oct 31 2017'], ['november', 'nov 1 2017 to nov 30 2017'], ['december', 'dec 1 2017 to dec 31 2017'], ['this february', 'feb 1 2017 to feb 28 2017'], ['this march', 'march 1 2017 to march 31 2017'], ['autumn 2017', 'sep 1 2017 to oct 31 2017'], ['third quarter 2017', 'jul 1 2017 to sep 30 2017'], ['fourth quarter 2017', 'oct 1 2017 to dec 31 2017'], ['halloween 2017', 'oct 31 2017'], ['black friday 2017', 'nov 24 2017'], ['new years day', 'jan 1 2017'], ['one week before christmas', 'dec 18 2017'], ['second week of february', 'feb 6 2017 to feb 12 2017'], ['jan 5 to 10', 'jan 5 2017 to jan 10 2017'], ['january 5th to 10th', 'jan 5 2017 to jan 10 2017'], ['tuesday to friday', 'jan 3 2017 to jan 6 2017'], ['sometime this week', 'dec 26 2016 to jan 1 2017'], ['by january 15th', 'by jan 15 2017'], ['jan 1 2017', 'jan 1 2017'], ['1 january 2017', 'jan 1 2017'], ['january first', 'jan 1 2017'], ['the 1st of january', 'jan 1 2017'], ['2017-01-01', 'jan 1 2017'], ['01/01/2017', 'jan 1 2017'], ['a month from now', 'feb 1 2017'], // ['this spring', 'March 1st 2017 to May 31 2017'], // ['this summer', 'june 1st 2017 to August 31 2017'], // ['this fall', 'September 1st 2017 to November 30 2017'], // ['this autumn', 'September 1st 2017 to November 30 2017'], // ['end of this summer', 'August 31 2017 - August 31 2017'], //-1 day // ['middle of this summer', 'Jul 13 2017 - Jul 13 2017'], //-6 weeks // ['this winter', 'dec 1st 2017 to February 28 2018'], // ['this spring', 'March 1 to May 31'], // ['this spring', 'March 1 2017 to May 31 2017'], // ['this fall', 'September 1 2017 to November 30 2017'], // ['next winter', 'dec 1st 2018 to February 28 2019'], // ['winter 2020', 'dec 1st 2020 to February 28 2021'], // ['winter of 1992', 'dec 1st 1992 to February 28 1993'], // ['spring 2015', 'March 1 2015 to May 31 2015'], // ['fall 2012', 'September 1 2012 to November 30 2012'], // ['autumn of 2013', 'September 1 2013 to November 30 2013'], // ['last winter', 'December 1st 2015 through February 27 2016'], //last // ['this winter', 'December 1st 2016 to February 27 2017'], //current // ['next winter', 'December 1st 2017 until February 27 2018'], //next // ['end of this winter', 'February 28 2016 to February 28 2016'], //end ], }, ] const fmt = function (str) { return spacetime(str).format('nice') } test('full-dates', (t) => { tests.forEach((obj) => { const context = { today: obj.today, timezone: 'Canada/Pacific', } obj.tests.forEach((a) => { const left = nlp(a[0]).dates(context).json()[0] || {} // ensure we found no date, if we shouldn't have if (!a[1]) { t.equal(left, undefined, 'no-date:' + a[0]) return } const right = nlp(a[1]).dates(context).json()[0] || {} left.dates = left.dates || {} right.dates = right.dates || {} t.equal(fmt(left.dates.start), fmt(right.dates.start), '[start] ' + a[0]) t.equal(fmt(left.dates.end), fmt(right.dates.end), '[end] ' + a[0]) }) }) t.end() })