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