Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add word boundary check to period tokenizer regex.

When only a millisecond based period is provided (e.g. "45 milliseconds"), the period is recognized as minutes ("45m").
This commit adds a word boundary check to the tokenizer regex to distinguish between minutes and milliseconds.
  • Loading branch information...
commit e897c5b69d8b7e3775f7766dca369cbf4f77fefc 1 parent 5a8edb9
@fschaefer authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  timed.js
2  timed.js
@@ -42,7 +42,7 @@
if (isNaN(parseInt(period,10))) period = '1'+period;
- var match = period.toLowerCase().replace(/[^a-z0-9\.]/g, "").match(/(?:(\d+(?:\.\d+)?)(?:days?|d))?(?:(\d+(?:\.\d+)?)(?:hours?|hrs?|h))?(?:(\d+(?:\.\d+)?)(?:minutes?|mins?|m))?(?:(\d+(?:\.\d+)?)(?:seconds?|secs?|s))?(?:(\d+(?:\.\d+)?)(?:milliseconds?|ms))?/);
+ var match = period.toLowerCase().replace(/[^a-z0-9\.]/g, "").match(/(?:(\d+(?:\.\d+)?)(?:days?|d))?(?:(\d+(?:\.\d+)?)(?:hours?|hrs?|h))?(?:(\d+(?:\.\d+)?)(?:minutes?|mins?|m\b))?(?:(\d+(?:\.\d+)?)(?:seconds?|secs?|s))?(?:(\d+(?:\.\d+)?)(?:milliseconds?|ms))?/);
if (match[0]) {
parsed.when =
Please sign in to comment.
Something went wrong with that request. Please try again.