Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 350399

Summary: AbstractDateField with time rejects "short" date strings
Product: z_Archived Reporter: Beat Schwarzentrub <bsh>
Component: ScoutAssignee: Project Inbox <scout.core-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ivan.motsch, zimmermann
Version: unspecifiedFlags: zimmermann: indigo+
zimmermann: juno+
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch none

Description Beat Schwarzentrub CLA 2011-06-27 02:58:29 EDT
Build Identifier: 3.7.0.2011-Jun 2011

PROBLEM DESCRIPTION:
An ordinary date field is able to parse "short" input string, i.e. 15122010 --> 15.12.2010 or 010111 --> 01.01.2011. A date field with time should allow this form too, especially because the GUI uses separate date and time entry fields. However, it does not, the value is rejected.

There is a related problem with the DateTimeField when a "delta string" is entered as a date, e.g. "+7" (= today + 7 days). A date field without time can parse this, a field with time can not.

EVALUATION:
The method AbstractDateField.parseDateTimeFormatsInternal(String, BooleanHolder) does not work correctly. The "text" parameter contains both the date and the time, and the parser cannot handle this case correctly when the date is entered in short form. (Input string then looks something like "15122010 00:00".)

PROPOSED SOLUTION:
See attached patch (fixes both problems), but maybe there is a better solution.

Reproducible: Always

Steps to Reproduce:
See problem description.
Comment 1 Beat Schwarzentrub CLA 2011-06-27 02:59:02 EDT
Created attachment 198623 [details]
Patch
Comment 2 Ivan Motsch CLA 2011-06-29 07:21:50 EDT
Fixed in AbstractDate model class using a thread local parse context to parse splitted date/time parts.
Comment 3 Matthias Zimmermann CLA 2011-10-10 12:44:37 EDT
shipped with scout 3.7.1
Comment 4 Matthias Zimmermann CLA 2012-05-23 11:19:32 EDT
Comment on attachment 198623 [details]
Patch

patch was not used by ivan motsch