captbaritone / captbaritone/datejs

TimePeriod month behavior patch (time.js)

Open
#133 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
JavaScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.