| Summary: | String-to-date conversion treats Feb 29 as March 1 | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Matt Heitz <mheitz> |
| Component: | EDT | Assignee: | Matt Heitz <mheitz> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Fixed with changes to the runtime (egl.processFunction and helper functions). We now add a property to the Date object to keep track of when we've seen Feb 29. Once we're done parsing, if the flag is set we make sure the year is a leap year and then reset the date to Feb 29 because it may have rolled forward. The testcase now correctly assigns 02/29/2012 in the second assignment. The third assignment now correctly throws an exception (because 2011 isn't a leap year, so it doesn't have a Feb 29). Closing. |
When we convert a string containing February 29th to a date, it "rolls forward" to March 1st. Here's a testcase. The first assignment works fine. The second turns Feb 29 into March 1. The third does the same thing, even though 2011 isn't a leap year. handler TestRUI type RUIHandler { onConstructionFunction = start } function start() d date; d = "02/28/2012"; SysLib.writeStdout( d ); d = "02/29/2012"; SysLib.writeStdout( d ); d = "02/29/2011"; SysLib.writeStdout( d ); end end