File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -126,15 +126,22 @@ void QgsDateTimeEditWrapper::dateTimeChanged( const QDateTime &dateTime )
126
126
emit valueChanged ( dateTime.time () );
127
127
break ;
128
128
default :
129
- const bool fieldIsoFormat = config ( QStringLiteral ( " field_iso_format" ), false ).toBool ();
130
- const QString fieldFormat = config ( QStringLiteral ( " field_format" ), QgsDateTimeFieldFormatter::defaultFormat ( field ().type () ) ).toString ();
131
- if ( fieldIsoFormat )
129
+ if ( !dateTime.isValid () || dateTime.isNull () )
132
130
{
133
- emit valueChanged ( dateTime. toString ( Qt::ISODate ) );
131
+ emit valueChanged ( QVariant ( field (). type () ) );
134
132
}
135
133
else
136
134
{
137
- emit valueChanged ( dateTime.toString ( fieldFormat ) );
135
+ const bool fieldIsoFormat = config ( QStringLiteral ( " field_iso_format" ), false ).toBool ();
136
+ const QString fieldFormat = config ( QStringLiteral ( " field_format" ), QgsDateTimeFieldFormatter::defaultFormat ( field ().type () ) ).toString ();
137
+ if ( fieldIsoFormat )
138
+ {
139
+ emit valueChanged ( dateTime.toString ( Qt::ISODate ) );
140
+ }
141
+ else
142
+ {
143
+ emit valueChanged ( dateTime.toString ( fieldFormat ) );
144
+ }
138
145
}
139
146
break ;
140
147
}
You can’t perform that action at this time.
0 commit comments