Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/qml/editorwidgets/DateTime.qml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ EditorWidgetBase {
return Qt.formatDateTime(value, displayFormat);
}
} else {
const date = Date.fromLocaleString(Qt.locale(), value, !!config['field_iso_format'] ? 'yyyy-MM-dd HH:mm:ss+t' : config['field_format'] !== undefined ? config['field_format'] : '');
let dateFormat = config['display_format'] !== undefined ? config['display_format'] : '';
if (!!config['field_format_overwrite']) {
console.log('!!!');
dateFormat = !!config['field_iso_format'] ? 'yyyy-MM-dd HH:mm:ss+t' : config['field_format'];
}
const date = Date.fromLocaleString(Qt.locale(), value, dateFormat);
if (date.toString() === "Invalid Date") {
try {
return Qt.formatDateTime(value, displayFormat);
Expand Down Expand Up @@ -203,7 +208,11 @@ EditorWidgetBase {
if (main.isDateTimeType) {
valueChangeRequested(currentDate, false);
} else {
const textDate = Qt.formatDateTime(currentDate, !!config['field_iso_format'] ? Qt.ISODate : config['field_format']);
let dateFormat = config['display_format'] !== undefined ? config['display_format'] : '';
if (!!config['field_format_overwrite']) {
dateFormat = !!config['field_iso_format'] ? 'yyyy-MM-dd HH:mm:ss+t' : config['field_format'];
Copy link
Collaborator

@kaustuvpokharel kaustuvpokharel Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nirvn in what case is this condition triggered ? Just curious

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaustuvpokharel , explanation coming when I reach my workstation

}
const textDate = Qt.formatDateTime(currentDate, dateFormat);
valueChangeRequested(textDate, false);
}
displayToast(qsTr('Date value set to today.'));
Expand All @@ -225,7 +234,11 @@ EditorWidgetBase {
if (main.isDateTimeType) {
valueChangeRequested(date, date === undefined);
} else {
const textDate = Qt.formatDateTime(date, !!config['field_iso_format'] ? Qt.ISODate : config['field_format']);
let dateFormat = config['display_format'] !== undefined ? config['display_format'] : '';
if (!!config['field_format_overwrite']) {
dateFormat = !!config['field_iso_format'] ? 'yyyy-MM-dd HH:mm:ss+t' : config['field_format'];
}
const textDate = Qt.formatDateTime(date, dateFormat);
valueChangeRequested(textDate, date === undefined);
}
}
Expand Down
Binary file modified test/testdata/TestRelationValues.ods
Binary file not shown.
Loading