DateTime-Widget not reliable [message #537428] |
Wed, 02 June 2010 12:34 |
Bassspieler Messages: 40 Registered: April 2010 Location: Germany |
Member |
|
|
Hi!
My DateTime-Widgets from RAP 1.3 RC2 act strange. I initialize them with the current date '2010-06-02'. Then I click into the spinner for months and type '01'. Then I click into the spinner for days and type '031' to get the 31th of january.
When I read the date from the wiget I get '2010-02-01'. It just "works" for the number 31, but any of the 31-months.
[Updated on: Mon, 12 July 2010 11:03] Report message to a moderator
|
|
|
|
Re: DateTime - Bug? [message #543378 is a reply to message #537818] |
Tue, 29 June 2010 09:17 |
Bassspieler Messages: 40 Registered: April 2010 Location: Germany |
Member |
|
|
Ok, now it's already an open Bug.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=315950
But I really do have to stress the importance of this, I guess.
(1)
DateTime-Widget initialized with "01.06.2010"
- Open drop-down-calendar
- Switch to May
- Select "31"
- Query the date from the DateTime-Widget
-> "01.05.2010" is your result (wrong)
But it get's even more strange.
(2a)
DateTime-Widget initialized with "01.05.2010"
- Open drop-down-calendar
- Switch to June
- Select "14"
- Query the date from DateTime-Widget
-> "14.06.2010" is your result
- Open drop-down-calendar
- Switch to may
- Select "31"
-> "14.05.2010" is your result (wrong)
(2b)
DateTime-Widget initialized with "01.05.2010"
- Open drop-down-calendar
- Switch to June
- Select "14"
- Do not Query the date from DateTime-Widget
- Open drop-down-calendar
- Switch to may
- Select "31"
-> "31.05.2010" is your result (right)
If you can reproduce this, than it's an absolutely critical bug for any running application, isn't it?
Or am I just using the DateTime-Widget the wrong way?
Best regards,
Bassspieler
Here is the snippet, that I used:
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DateTime; import org.eclipse.swt.widgets.Shell;
public class DateTimeDialog extends TrayDialog {
private DateTime dtDate;
public DateTimeDialog(Shell shell) {
super(shell);
}
@Override
protected Control createDialogArea(Composite parent) {
dtDate = new DateTime(parent, SWT.DATE | SWT.DROP_DOWN | SWT.BORDER);
dtDate.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
dtDate.setDate(2010, 5, 1); // this is: "2010-06-01"
return parent;
}
@Override
protected void okPressed() {
System.out.println(dtDate.getYear()
+ " " + (dtDate.getMonth() + 1) // to see the "human" month-digit
+ " " + dtDate.getDay());
}
}
[Updated on: Tue, 29 June 2010 09:28] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03172 seconds