Skip to content

Commit

Permalink
Merge pull request #189 from nirelbaz/master
Browse files Browse the repository at this point in the history
Add 'from text' and 'to text' support for minutes
  • Loading branch information
arolson101 committed Feb 14, 2018
2 parents ebca44b + d71e857 commit 7a14410
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion lib/nlp.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
]
ToText.IMPLEMENTED = []
ToText.IMPLEMENTED[RRule.HOURLY] = common
ToText.IMPLEMENTED[RRule.MINUTELY] = common
ToText.IMPLEMENTED[RRule.DAILY] = ['byhour'].concat(common)
ToText.IMPLEMENTED[RRule.WEEKLY] = common
ToText.IMPLEMENTED[RRule.MONTHLY] = common
Expand Down Expand Up @@ -193,6 +194,15 @@
? gettext('hours') : gettext('hour'))
},

MINUTELY: function () {
var gettext = this.gettext

if (this.options.interval !== 1) this.add(this.options.interval)

this.add(this.plural(this.options.interval)
? gettext('minutes') : gettext('minutes'))
},

DAILY: function () {
var gettext = this.gettext

Expand Down Expand Up @@ -324,7 +334,7 @@
this.add(gettext('on the'))
.add(this.list(this.bymonthday, this.nth, gettext('and')))
}
// this.add(gettext('DAY'))
// this.add(gettext('DAY'))
},

_byweekday: function () {
Expand Down Expand Up @@ -570,6 +580,14 @@
}
break

case 'minute(s)':
options.freq = RRule.MINUTELY
if (ttr.nextSymbol()) {
ON()
F()
}
break

case 'month(s)':
options.freq = RRule.MONTHLY
if (ttr.nextSymbol()) {
Expand Down Expand Up @@ -938,6 +956,7 @@
'weekday(s)': /^weekdays?/i,
'week(s)': /^weeks?/i,
'hour(s)': /^hours?/i,
'minute(s)': /^minutes?/i,
'month(s)': /^months?/i,
'year(s)': /^years?/i,
'on': /^(on|in)/i,
Expand Down

0 comments on commit 7a14410

Please sign in to comment.