saheb11 / datejs

Automatically exported from code.google.com/p/datejs
Other
0 stars 0 forks source link

TimePeriod month behavior patch (time.js) #133

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
new TimePeriod(Date.parse('2011-08-25'), Date.parse('2011-09-25'))

What is the expected output? What do you see instead?
expected: months === undefined, days === 0. observed: months === undefined days 
=== 31

What version of the product are you using? On what operating system?
latest from svn. macos, chrome 14.0

Please provide any additional information below.

This should fix it unless I'm misunderstanding something.

245c245
<             while (d1 < d2 && 
d1.clone().addDays(Date.getDaysInMonth(d1.getYear(), d1.getMonth()) ) < d2) {

---
>             while (d1 < d2 && d1.clone().addMonths(1) <= d2) {
251c251
<             while (d1 > d2 && d1.clone().addDays(-d1.getDaysInMonth()) > d2) {

---
>             while (d1 > d2 && d1.clone().addMonths(-1) >= d2) {
255a256
> 

Original issue reported on code.google.com by ehb...@gmail.com on 7 Oct 2011 at 8:08

GoogleCodeExporter commented 8 years ago
Sorry...expected was months === 1, days === 0. observed was still correct.

Original comment by ehb...@gmail.com on 7 Oct 2011 at 8:09

GoogleCodeExporter commented 8 years ago
fixed in the current build in my fork: https://github.com/abritinthebay/datejs/

Original comment by darkcr...@gmail.com on 16 Sep 2013 at 5:41