eric/Datejs — pull request #1 by ianso (2011-11-01 19:29:27+00:00)
Title: fix for ago / before functions of datejs

Hi Eric,

First of all, I'm sorry I can't provide a regression test for the bug this patch is supposed to fix. Neither have I built the script and updated the build/ directory - I have looked and I can't find any instructions on which minifier / macros were used and I don't want to bork things up. If you can help with this then I can give you a much better patch with all the builds fixed as well.

This is a one-line fix (despite appearances in the diff) that fixes the `(6).months().ago()` set of expressions. The reason the fix works is that the `add()` method in `core.js` line 308 expects the plural lowercase form of the duration unit to be set, but without the `+"s"` that I added, sugarpak adds the property as the *singular* lowercase.

I've made a check of the code and I can't find any other location where the singular is specifically used except in `set`, so I don't believe that this patch should have any side-effects, for example if the inconsistency between singular and plural is a wider problem in the codebase.

Best regards,

- Ian