So What's Wrong With 5.0.03? |
...and other PowerBuilder versions before 5.0.04 - the officially Y2K compliant version |
That's what a lot of people have been asking ever since Sybase declared that only versions above 5.0.04 were certified to be Y2K compliant. What I could gather from discussions in various PowerBuilder newsgroups and mailing lists is that version prior to 5.0.04 have a problem with the EditMask incorrectly recognizing leap years. However, it also seems that 5.0.03 does not have these problems.
I did some testing with leap years and have come to the conclusion that 5.0.02 indeed has a problem with the EditMask. Version 5.0.04 has fixed this problem. The problem also did not show up in the last PB6.0.01 beta(Build 390).
What's the EditMask Leap Year Problem? |
In a date column with an EditMask, the EditMask fails to recognize leap years correctly for the year 2000 and beyond. It prevents the user from entering valid dates like 2000-02-29, 2004-02-29, 2008-02-29 etc. but, allows the user to input invalid dates like 2002-02-29, 2006-02-29.
Is this a potentially grave situation? |
Even though the EditMask does goof up, fortunately the datawindow datatype validation does catch all the invalid dates correctly. So the invalid date never makes it to even the Itemchanged event. Hence the chances are that these your code will not encounter invalid dates and it will not jeopardize you data.
However, if the code is using GetText() anywhere to obtain the contents of the field, that code will encounter the invalid dates. This could cause serious trouble depending upon what is being done with the date text.
Of course, the most certain problem is that the users will not be able to input valid leap days. This probably should be a reason enough for most applications to upgrade to 5.0.04.
Leap Year Testing |
5.0.0.2 | 5.0.04 | 6.5 Beta | ||||||
Date | Date Is | EditMask | EM Validation | DW Datatype Validation | EM Validation | DW Datatype Validation | EM Validation | DW Datatype Validation |
1900-02-29 | NotValid | mm/dd/yy | Not Tested | Not Tested | Not Tested | Not Tested | Not Tested | Not Tested |
NotValid | mm/dd/yyyy | Disallowed | Disallowed | Disallowed | Disallowed | Disallowed | Disallowed | |
NotValid | dd/mm/yy | Not Tested | Not Tested | Not Tested | Not Tested | Not Tested | Not Tested | |
NotValid | dd/mm/yyyy | Disallowed | Disallowed | Disallowed | Disallowed | Disallowed | Disallowed | |
NotValid | yyyy/mm/dd | Disallowed | Disallowed | Disallowed | Disallowed | Disallowed | Disallowed | |
1902-02-29 | NotValid | mm/dd/yy | Not Tested | Not Tested | Not Tested | Not Tested | Not Tested | Not Tested |
NotValid | mm/dd/yyyy | Disallowed | Disallowed | Disallowed | Disallowed | Disallowed | Disallowed | |
NotValid | dd/mm/yy | Not Tested | Not Tested | Not Tested | Not Tested | Not Tested | Not Tested | |
NotValid | dd/mm/yyyy | Disallowed | Not Relevant | Disallowed | Not Relevant | Disallowed | Not Relevant | |
NotValid | yyyy/mm/dd | Disallowed | Not Relevant | Disallowed | Not Relevant | Disallowed | Not Relevant | |
1904-02-29 | Valid | mm/dd/yy | Not Tested | Not Tested | Not Tested | Not Tested | Not Tested | Not Tested |
Valid | mm/dd/yyyy | Allowed | Allowed | Allowed | Allowed | Allowed | Allowed | |
Valid | dd/mm/yy | Not Tested | Not Tested | Not Tested | Not Tested | Not Tested | Not Tested | |
Valid | dd/mm/yyyy | Allowed | Allowed | Allowed | Allowed | Allowed | Allowed | |
Valid | yyyy/mm/dd | Allowed | Allowed | Allowed | Allowed | Allowed | Allowed | |
2000-02-29 | Valid | mm/dd/yy | Disallowed | Allowed | Allowed | Allowed | Allowed | Allowed |
Valid | mm/dd/yyyy | Disallowed | Allowed | Allowed | Allowed | Allowed | Allowed | |
Valid | dd/mm/yy | Disallowed | Allowed | Allowed | Allowed | Allowed | Allowed | |
Valid | dd/mm/yyyy | Disallowed | Allowed | Allowed | Allowed | Allowed | Allowed | |
Valid | yyyy/mm/dd | Allowed | Allowed | Allowed | Allowed | Allowed | Allowed | |
2002-02-29 | NotValid | mm/dd/yy | Allowed | Disallowed | Disallowed* | Not Relevant | Disallowed | Not Relevant |
NotValid | mm/dd/yyyy | Allowed | Disallowed | Disallowed* | Not Relevant | Disallowed | Not Relevant | |
NotValid | dd/mm/yy | Allowed | Disallowed | Disallowed* | Not Relevant | Disallowed | Not Relevant | |
NotValid | dd/mm/yyyy | Allowed | Disallowed | Disallowed* | Not Relevant | Disallowed | Not Relevant | |
NotValid | yyyy/mm/dd | Disallowed | Not Relevant | Disallowed* | Not Relevant | Disallowed | Not Relevant | |
2004-02-29 | Valid | mm/dd/yy | Disallowed | Not Relevant | Allowed | Allowed | Allowed | Allowed |
Valid | mm/dd/yyyy | Disallowed | Not Relevant | Allowed | Allowed | Allowed | Allowed | |
Valid | dd/mm/yy | Disallowed | Not Relevant | Allowed | Allowed | Allowed | Allowed | |
Valid | dd/mm/yyyy | Disallowed | Not Relevant | Allowed | Allowed | Allowed | Allowed | |
Valid | yyyy/mm/dd | Allowed | Allowed | Allowed | Allowed | Allowed | Allowed | |
Not Tested | Cannot be tested since for 2 digit years, PB always interprets 00-49 as 2000 - 2049. |
Not Relevant | Since the DW EditMask disallows this kind of an entry there is no scope for validation. It's still relevant for dates like 1900 and 2000, since the user is not required to type in the last 0. |
* | There's a tricky situation concerning this date. Even though the EditMask disallows this date if you try to enter it straight as 2002, there's a way you can still sneak this date in. Enter a valid leap year like 2016-02-29. Then using the cursor keys move just before the 16. Enter 0. Enter 2. The edit mask accepts it this time! Fortunately, the DW datatype validation still does it's job and manages to catch it as an invalid date. This problem was reported by Andrew Bate on the PB-L mailing list. |
Points to be Noted:
The yyyy/mm/dd EditMask is able to recognize leap years correctly even when other masks fail to do so.
Even 5.0.04 still has a little problem with 2002.
Jiggy, 28 July 1998
Back to my HomePage