Bug #9916
FILL-IN: date format: incorrect condition for triggering normalization of third component
100%
History
#1 Updated by Vladimir Tsichevski over 1 year ago
In OE, a FILL-IN widget bound to a date variable with a format containing separators (e.g., "99/99/9999") processes separator character input based on the caret position and character typed. The following rules apply, evaluated in order, stopping after the first matching condition:
- If the caret is at a separator position:
- If the typed character matches the separator, move the caret one position right.
- Otherwise, take no action.
- If the caret is within the year component and a minus sign (
-) is typed, insert the minus sign at the current caret position. - If the caret is within the third component, normalize the component without changing the caret position.
- If the typed character matches the next separator to the right of the caret, normalize the current component and move the caret to the position immediately right of the separator.
In FWD, for condition 3, the condition triggering normalization deviates from OE in both GUI and ChUI modes. When the caret is in the third component, normalization is triggered only if the typed character matches any of the two format’s separators (e.g., / or . for "99.99/9999"). In OE, normalization occurs for any separator character (., /, or -) in both character and GUI modes, regardless of the format’s specific separators.
Example
DEFINE VARIABLE myDate AS DATE.
DEFINE FRAME myFrame
myDate FORMAT "99/99/9999".
ENABLE myDate WITH FRAME myFrame.
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.
- OE Behavior: If the user types "12/31/2" and the caret is in the year (third component), typing
.,/, or-normalizes "2" to "2002" (caret stays in place) in both character and GUI modes. - FWD Behavior: In both GUI and ChUI modes, normalization is triggered only if
/is typed (matching the format’s separator), not.or-.
#2 Updated by Vladimir Tsichevski over 1 year ago
- reviewer Greg Shah added
Fixed in 9916a rev. 15867. The fix was trivial. Please, review.
#3 Updated by Vladimir Tsichevski over 1 year ago
- Status changed from New to WIP
- Assignee set to Vladimir Tsichevski
- % Done changed from 0 to 100
#4 Updated by Vladimir Tsichevski over 1 year ago
- Status changed from WIP to Review
#5 Updated by Greg Shah about 1 year ago
- reviewer Hynek Cihlar added
- reviewer deleted (
Greg Shah)
#7 Updated by Vladimir Tsichevski about 1 year ago
9916a rebased to the latest trunk, rev. 16014. Please, review.
#8 Updated by Hynek Cihlar about 1 year ago
- Status changed from Review to Internal Test
Code review 9916a. The changes look good. Please go ahead with GUI regression testing, I will run ChUI tests.
#9 Updated by Hynek Cihlar about 1 year ago
There are ChUI regressions.
#10 Updated by Vladimir Tsichevski about 1 year ago
- Status changed from Internal Test to WIP
Hynek Cihlar wrote:
There are ChUI regressions.
The change in 9916a is incorrect, now I am in the process of fixing. Please, stop testing this change. Sorry for the inconvenience.
#11 Updated by Vladimir Tsichevski about 1 year ago
The specification and the issue description were updated:
Typing One of Date Component Separators (Dot, Minus, or Slash)¶
The following rules are applied sequentially, halting at the first matching condition:
- For a format without separators, no action is taken.
- If the caret is located at a separator:
- If the typed character matches the separator at the caret position, move the caret one position to the right.
- If the caret is within the year component and a minus sign (
-) is entered, insert or append the minus sign at the current caret position, provided the format length supports it. - If the caret is within the third component, attempt to normalize this component (refer to the corner case below) without adjusting the caret position.
- If the caret is within the first or second component and the typed character matches the next separator to the right of the caret, attempt to normalize the current component (refer to the corner case below) and shift the caret to the position immediately following the next separator.
Corner Case¶
If a component is the year component, contains one or more minus signs, and the caret is not positioned to the right of the rightmost minus sign, no action is taken.
FWD Issue¶
In FWD, the normalization trigger condition differs from OE in both GUI and ChUI modes. When the caret is in the third component, normalization is activated only if the typed character matches one of the format’s defined separators (e.g., / or . for "99.99/9999"). In contrast, OE triggers normalization for any separator character (., /, or -) in both character and GUI modes, regardless of the format’s specific separators.
Example Program¶
DEFINE VARIABLE myDate AS DATE.
DEFINE FRAME myFrame
myDate FORMAT "99/99/9999".
ENABLE myDate WITH FRAME myFrame.
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.
- Execute this program in GUI or ChUI mode, ensuring the last data component is not the year (e.g., set
SESSION:DATE-FORMAT='ydm') to prevent literal insertion of the minus (-). - Input
12/31/2. - Type any of
.,-, or/.
- OE Behavior: Typing any date separator character (
.,-, or/) triggers normalization of the third component. - FWD Behavior: Normalization is activated only when
/is typed (matching the format’s separators), excluding.or-.
#12 Updated by Vladimir Tsichevski about 1 year ago
- Status changed from WIP to Review
Fixed and rebased at rev. 16047. Please, review.
#13 Updated by Hynek Cihlar about 1 year ago
- Status changed from Review to Internal Test
Code review 9916a. The changes look good. Please go ahead with GUI regression testing, I started ChUI tests.
#14 Updated by Hynek Cihlar about 1 year ago
Hynek Cihlar wrote:
Code review 9916a. The changes look good. Please go ahead with GUI regression testing, I started ChUI tests.
ChUI tests passed.
#17 Updated by Hynek Cihlar 11 months ago
- Status changed from Internal Test to Merge Pending
Vladimir Tsichevski wrote:
I rebased the 9916a to trunk rev. 16141. Can we merge now?
Please 9916a merge to trunk.
#19 Updated by Hynek Cihlar 11 months ago
- Status changed from Merge Pending to Test
Are there any related customer test scenarios? Should the issue be moved to Test state?
#21 Updated by Hynek Cihlar 11 months ago
- Status changed from Test to Closed