• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

michaeldrennen / natural-date / 9
97%

Build:
DEFAULT BRANCH: master
Ran 08 Apr 2018 04:36PM UTC
Jobs 1
Files 29
Run time 1s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
9

push

travis-ci

michaeldrennen
Adding some code that handles the string:

Between Thanksgiving and Christmas 2017

The parse function starts by grouping them like:

Between (Thanksgiving) and (Christmas 2017)

Now assume that it's the year 2018.
The parse function will think that the Thanksgiving string means "Thanksgiving 2018"

However, that's obviously not what the user intended.

So the additional code checks to see if the first parsed section is of type "yearlessDate", and if so, it will replace the year with the year in the end date's parsed string.

Shit... now that I think about it... I will need to add more intelligent code. Think about this:

A user enters:
Between Christmas and Valentine's Day 2017

Well obviously they don't mean Christmas 2017. We need to assume that users list their dates in chronological order to be parsed.

In this case, I need to check if the NEW startDate is actually before the endDate. If it is not, then I need to subtract a year and reparse. Simply subtracting a year won't do, because for dates like "Thanksgiving", changing the year will most likely change the day of month as well. (Since Thanksgiving is the 4th Thursday in November. Look for that change in the next patch.

19 of 19 new or added lines in 2 files covered. (100.0%)

604 of 637 relevant lines covered (94.82%)

17.02 hits per line

Jobs
ID Job ID Ran Files Coverage
1 9.1 08 Apr 2018 04:36PM UTC 0
94.82
Travis Job 9.1
Source Files on build 9
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #9
  • cf667b0e on github
  • Prev Build on master (#6)
  • Next Build on master (#10)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc