Bug report #16657

date edit widget only shows current date whatever the real data is underneath

Added by Regis Haubourg almost 7 years ago. Updated about 6 years ago.

Status:Closed
Priority:High
Assignee:Denis Rouzaud
Category:Edit widget
Affected QGIS version:2.18.9 Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:24557

Description

Hi,
it seems a regression since 2.18.3, date edit widget will only show the current date in a form, even without any default value set or being readonly.
This makes it pretty unusable.

I had hard time spotting it since another issue with qlr export #16655 let me think that only my project was corrupted.

date_default_widget_value_issue.qgs (31 KB) Regis Haubourg, 2017-06-01 06:41 PM

test_date_constat.6.qgs (339 KB) Regis Haubourg, 2017-06-01 06:41 PM

Sélection_023.png (335 KB) Regis Haubourg, 2017-06-01 06:47 PM

date_default_issue.gpkg (52 KB) Regis Haubourg, 2017-06-02 10:11 AM

History

#1 Updated by Nyall Dawson almost 7 years ago

  • Status changed from Open to Feedback

That's a datetime field - I think the issue is that you've set the format to "date" along. Does it work correctly if you change that to "date/time"?

What data provider is this? can you share the data?

#2 Updated by Regis Haubourg almost 7 years ago

That's a datetime field - I think the issue is that you've set the format to "date" along. Does it work correctly if you change that to "date/time"?

Nope, I tested many widget configuration changes before. Only setting it back to textEdit allowed me to see the actual data.
What data provider is this? 

Original issue was detected in postgres with a view with edit triggers pointing to a table with a "timestamp with time zone" field.
can you share the data?

Oh, I joined the wrong file. Here is a gpkg file going with the date_default_widget_value_issue.qgs file

#3 Updated by Giovanni Manghi almost 7 years ago

  • Status changed from Feedback to Open

#4 Updated by Regis Haubourg almost 7 years ago

when I cast the field in the SQL view to a date field, QGIS will handle it correctly.

#5 Updated by Denis Rouzaud over 6 years ago

using yyyy-MM-dd HH:mm:ss+02 in the format solves the diplay issue.

The field format must be set accordingly to what is in the data, so it's not really a bug here.

Although I tried yyyy-MM-dd HH:mm:ss+t (time zone) without success. So there might be an issue here.

#6 Updated by Giovanni Manghi over 6 years ago

  • Status changed from Open to Feedback

#7 Updated by Denis Rouzaud over 6 years ago

  • Status changed from Feedback to Open

So I guess, there is two things to improve here:

  • guessing the format from the source
  • fix time zone format

#8 Updated by Giovanni Manghi over 6 years ago

Denis Rouzaud wrote:

So I guess, there is two things to improve here:

  • guessing the format from the source
  • fix time zone format

the ticket has been tagged as a regression because apparently the guessing worked until 2.18.3

#9 Updated by Denis Rouzaud over 6 years ago

  • Assignee set to Denis Rouzaud

#10 Updated by Regis Haubourg over 6 years ago

  • Priority changed from High to Normal

Lowering the priority since casting to DATE format gives a workaround

#11 Updated by Giovanni Manghi over 6 years ago

  • Priority changed from Normal to High

Regis Haubourg wrote:

Lowering the priority since casting to DATE format gives a workaround

still a regression, so to keep consistency with the others better keep priority "high".

#12 Updated by Luigi Pirelli over 6 years ago

error is probably only located in setting the correct format string here:
https://github.com/qgis/qgis/blob/release-2_18/src/gui/editorwidgets/qgsdatetimeeditfactory.cpp#L88
btw Qt:ISODate formate parse correctly the proposed date.

#14 Updated by Denis Rouzaud over 6 years ago

fixed in master and 2.18

#15 Updated by Nyall Dawson over 6 years ago

  • Status changed from Open to Closed

#16 Updated by Giovanni Manghi about 6 years ago

  • Resolution set to fixed/implemented

Also available in: Atom PDF