My favorites | Sign in
Logo
Project hosting will be READ-ONLY Wednesday at 8am PST due to brief network maintenance.
                
New issue | Search
for
| Advanced search | Search tips
Issue 39: [FIXED] TimePeriod for two dates is broken
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  May 2008
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by jeff.pennal, May 07, 2008
What steps will reproduce the problem?
1. Create a new TimePeriod object for two dates
2. var foo = TimePeriod(Date.today(), Date.today());


What is the expected output? What do you see instead?
expected: foo should be an object
actual: the error d1.getDaysInMonth() is not a function

What version of the product are you using? On what operating system?
Latest SVN nightly (as of May 7th, 2008)

Please provide any additional information below.
The problem is that lines 245 and 251 of time.js are using:
d1.getDaysInMonth()

However, getDaysInMonth is a static function, not an instance method. 

Changing the line:
 d1.getDaysInMonth() to
 Date.getDaysInMonth(d1.getYear(), d1.getMonth())

fixes the problem
 
Comment 1 by ge...@coolite.com, May 07, 2008
Thanks for pointing out the bug. 

I've fixed the problem in TimePeriod and updated SVN (Build #189).

Example

var start = new Date();
var end = Date.today().add(15).days();
var ts = new TimePeriod(start, end);

ts.getDays(); // 14
Summary: [FIXED] TimePeriod for two dates is broken
Status: Fixed
Sign in to add a comment

Hosted by Google Code