View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004399 | JEDI VCL | 00 JVCL Components | public | 2008-07-09 08:18 | 2008-08-12 03:47 |
Reporter | ZENsan | Assigned To | obones | ||
Priority | normal | Severity | tweak | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | Daily / GIT | ||||
Target Version | Fixed in Version | 3.35 | |||
Summary | 0004399: TJvDBDateTimePicker sets date to NULL | ||||
Description | When TJvDBDateTimePicker TrimValue = False and mode = time, if user sets time to 0:00:00, them editor sets whole field to NULL, not only time part. | ||||
Tags | No tags attached. | ||||
|
Please provide the zipped sources of a sample application showing this. |
2008-07-15 23:45
|
Project1.rar (375,559 bytes) |
|
Simply press Up and Down in Time editor. And date will set to 1899 year.. It works if we set initial value with time. But not works when start value is 0:0:0 for time. |
|
I'm unable to reproduce this. I used your application, clicked the "up" and "down" button in the time field, the date did not change. |
|
How it can happen if I launch the Project1.exe and it happens for, but not happens for you.. Maybe I have wrong Windows version? |
2008-07-27 01:49
|
HowToDo.zip (25,685 bytes) |
|
I uploaded HowToDO.zip - printscreens of steps I do so that this happens for attached Project1.rar->Project1.exe. And it doesn't happens in the same way for you??? |
|
JvDBDateTimePicker.pas FIX: function TJvDBDateTimePicker.IsDateAndTimeField: Boolean; begin with FDataLink do Result := (Field <> nil) and (Field.DataType in [ftDateTime {$IFDEF COMPILER6_UP}, ftTimeStamp {$ENDIF}]); end; procedure TJvDBDateTimePicker.UpdateData(Sender: TObject); begin // update value in datalink with date value in control, not from system // DataLink field might be empty if not(Assigned(Field) and FDataLink.Editing) then Exit; if Kind = dtkDate then begin if Trunc(NullDate) = Trunc(DateTime) then if TrimValue or not IsDateAndTimeField then Field.Value := Null else Field.AsDateTime := Frac(DateTime) else if TrimValue or not IsDateAndTimeField then Field.AsDateTime := Trunc(DateTime) else Field.AsDateTime := DateTime; end else if IsDateAndTimeField then begin if Frac(NullDate) = Frac(DateTime) then if TrimValue then Field.Value := Null else Field.AsDateTime := Trunc(DateTime) else if TrimValue then Field.AsDateTime := Frac(DateTime) else Field.AsDateTime := DateTime; end; end; |
|
One moment left, that if Kind is dtkTime and field is not IsDateAndTimeField then I ignore the update... Maybe there is better solution. But this I think is not bad also. |
|
I'm seeing it just fine now. Evaluating proposed fix... |
|
Why all those changes? I simply replaced if Frac(NullDate) = Frac(DateTime) then Field.AsDateTime := Trunc(DateTime) by if Frac(NullDate) = Frac(DateTime) then if TrimValue then Field.Value := Null else Field.AsDateTime := Trunc(DateTime) And it solves the issue. What do you think? |
|
If it works exactly the same way, then ok. Does it covers situation when that is not date and time field..? |
|
I don't know. Can you test that? |
|
:) Can you upload the PAS file for that unit? |
2008-08-12 02:27
|
JvDBDateTimePicker.pas (18,921 bytes) |
|
Done |
|
if Kind = dtkDate then begin if Trunc(NullDate) = Trunc(DateTime) then Field.Value := Null else if IsDateAndTimeField then Field.AsDateTime := DateTime else Field.AsDateTime := Trunc(DateTime); end In your source.. if Trunc(NullDate) = Trunc(DateTime) then Field.Value := Null will clear the time part if TrimValue is set to true. And this is not correct way. So I think that this source covers all proprties like TrimValue and also checks for Field datatype (so that it supports time part) so why there is so many checks.. if (Field = nil) or not FDataLink.Editing then Exit; if Kind = dtkDate then begin if Trunc(NullDate) = Trunc(DateTime) then if TrimValue or not IsDateAndTimeField then Field.Value := Null else Field.AsDateTime := Frac(DateTime) else if TrimValue or not IsDateAndTimeField then Field.AsDateTime := Trunc(DateTime) else Field.AsDateTime := DateTime; end else if IsDateAndTimeField then begin if Frac(NullDate) = Frac(DateTime) then if TrimValue then Field.Value := Null else Field.AsDateTime := Trunc(DateTime) else if TrimValue then Field.AsDateTime := Frac(DateTime) else Field.AsDateTime := DateTime; end; And with this code user can understand all the logic of this control. What you think? |
|
Yep, that's better. This is now in SVN. |
Date Modified | Username | Field | Change |
---|---|---|---|
2008-07-09 08:18 | ZENsan | New Issue | |
2008-07-15 01:00 | obones | Note Added: 0014378 | |
2008-07-15 01:00 | obones | Status | new => feedback |
2008-07-15 23:45 | ZENsan | File Added: Project1.rar | |
2008-07-15 23:46 | ZENsan | Note Added: 0014383 | |
2008-07-21 00:24 | obones | Status | feedback => acknowledged |
2008-07-23 06:36 | obones | Status | acknowledged => resolved |
2008-07-23 06:36 | obones | Resolution | open => unable to reproduce |
2008-07-23 06:36 | obones | Assigned To | => obones |
2008-07-23 06:36 | obones | Note Added: 0014414 | |
2008-07-27 01:49 | ZENsan | Status | resolved => feedback |
2008-07-27 01:49 | ZENsan | Resolution | unable to reproduce => reopened |
2008-07-27 01:49 | ZENsan | Note Added: 0014460 | |
2008-07-27 01:49 | ZENsan | File Added: HowToDo.zip | |
2008-07-27 01:50 | ZENsan | Note Added: 0014461 | |
2008-08-03 23:43 | ZENsan | Note Added: 0014472 | |
2008-08-03 23:45 | ZENsan | Note Edited: 0014472 | |
2008-08-03 23:49 | ZENsan | Note Edited: 0014472 | |
2008-08-03 23:50 | ZENsan | Note Edited: 0014472 | |
2008-08-04 05:21 | ZENsan | Note Edited: 0014472 | |
2008-08-04 05:23 | ZENsan | Note Added: 0014475 | |
2008-08-12 00:26 | obones | Note Added: 0014493 | |
2008-08-12 00:26 | obones | Status | feedback => confirmed |
2008-08-12 00:30 | obones | Note Added: 0014494 | |
2008-08-12 00:30 | obones | Status | confirmed => feedback |
2008-08-12 02:13 | ZENsan | Note Added: 0014497 | |
2008-08-12 02:17 | obones | Note Added: 0014498 | |
2008-08-12 02:19 | ZENsan | Note Added: 0014499 | |
2008-08-12 02:27 | obones | File Added: JvDBDateTimePicker.pas | |
2008-08-12 02:27 | obones | Note Added: 0014500 | |
2008-08-12 02:51 | ZENsan | Note Added: 0014501 | |
2008-08-12 03:46 | obones | Status | feedback => resolved |
2008-08-12 03:46 | obones | Fixed in Version | => Daily / SVN |
2008-08-12 03:46 | obones | Resolution | reopened => fixed |
2008-08-12 03:46 | obones | Note Added: 0014502 |