History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-3330
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: -- --
Assignee: Unassigned
Reporter: hkato
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

leap year check in basedatepicker.lzx is not correct

Created: 15/Dec/06 08:48 AM   Updated: 31/Jan/08 11:22 AM
Component/s: Components - base
Affects Version/s: 4.0.2
Fix Version/s: RingDing (4.1)

Time Tracking:
Not Specified

Severity: Minor
Fixed in Change#: 5,394
Runtime: N/A
Fix in hand: True


 Description  « Hide
I found a bug in basedatepicker#getNumberOfDaysInMonth that the condition of leap year is not enough:

  before : year % 4 == 0
  after : ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)

thanks.

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Frisco Del Rosario - 09/Feb/07 05:05 PM
It's true!! I promise to revisit this bug in the year 2099 to see if our datepicker is working correctly.

The "leap" idea works better if leap years happen 97 times out of 400 years, so years divisible by 100 are only leap years when they're divisible by 400 also.

Mamye Kratt - 03/Jul/07 03:08 PM
(4.0 branch (4.0.3) build r5544)
Closed.

Mamye Kratt - 03/Jul/07 03:08 PM
Need to check in legals.

Frisco Del Rosario - 05/Jul/07 10:16 AM
Tested and greenlined in build 5593.

<canvas debug="true">
<include href="lzunit"/>

        <handler name="oninit">
         theDate=new Date(2100, 1, 29); // if Feb. 29 2100 were Leap Day, display.date.getText would be February 29 2100
display.year.setText(theDate.getFullYear() );
            display.month.datapath.setXPath("datepicker_strings_en:/months/month[@index='" + theDate.getMonth() + "']/@full" );
            display.date.setText( theDate.getDate() );
        </handler>

     <datepicker/>

     <view id="display">
        <text name="month" resize="true" datapath="."/>
        <text name="date" resize="true"/>
        <text name="year" resize="true"/>
        <simplelayout axis="x" spacing="2"/>
     </view>
     <simplelayout axis="y" spacing="10"/>

<TestSuite>
<TestCase>
<method name="test2100NotLeapYear">
assertTrue(display.date.getText("March 1 2100"));
</method>
</TestCase>
</TestSuite>

</canvas>

Mamye Kratt - 31/Jan/08 11:22 AM
(trunk 4 local build r7937)
Fixed.