diff --git a/plugins/dates/scratch.js b/plugins/dates/scratch.js index eeaff95c8..713ea79f0 100644 --- a/plugins/dates/scratch.js +++ b/plugins/dates/scratch.js @@ -16,7 +16,7 @@ const context = { } // let doc = nlp('end of april') -let doc = nlp('middle of tuesday') //.debug() +let doc = nlp('middle of next quarter') //.debug() let dates = doc.dates(context) dates = dates.get() diff --git a/plugins/dates/src/parseDate/units/_day.js b/plugins/dates/src/parseDate/units/_day.js index c9488fca5..1433e89f8 100644 --- a/plugins/dates/src/parseDate/units/_day.js +++ b/plugins/dates/src/parseDate/units/_day.js @@ -9,6 +9,14 @@ class Day extends Unit { this.d = this.d.startOf('day') } } + middle() { + this.d = this.d.time('10am') + return this + } + beforeEnd() { + this.d = this.d.time('2pm') + return this + } } // like 'feb 2' @@ -33,7 +41,7 @@ class CalendarDate extends Day { class WeekDay extends Day { constructor(input, unit, context) { super(input, unit, context) - this.unit = 'week' + this.unit = 'day' // is the input just a weekday? if (typeof input === 'string') { this.d = spacetime(context.today, context.timezone) @@ -53,13 +61,6 @@ class WeekDay extends Day { clone() { return new WeekDay(this.d, this.unit, this.context) } - end() { - this.d = this.d.endOf('day') - if (this.context.dayEnd) { - this.d = this.d.time(this.context.dayEnd) - } - return this - } next() { this.d = this.d.add(7, 'days') this.d = this.d.day(this.weekDay)