Skip to content

Commit f4d654e

Browse files
authored
Handle timezone correctly during saving qc annotation (#1163)
1 parent 0b55590 commit f4d654e

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

webapp/TargetedMS/js/QCTrendPlotPanel.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ Ext4.define('LABKEY.targetedms.QCTrendPlotPanel', {
19721972
},
19731973

19741974
openAnnotationDialog: function (addNew, data) {
1975-
const date = this.formatDate(new Date(data['Date']), false);
1975+
const date = this.formatDate(data['Date'], false);
19761976
const title = addNew ? 'Add Annotation' : 'Edit Annotation';
19771977
const me = this;
19781978

@@ -2019,7 +2019,8 @@ Ext4.define('LABKEY.targetedms.QCTrendPlotPanel', {
20192019
name: 'annotationDate',
20202020
format: 'Y-m-d',
20212021
allowBlank: false,
2022-
value: date
2022+
value: date,
2023+
submitFormat: 'Y-m-d'
20232024
}],
20242025

20252026
buttons: [{
@@ -2081,13 +2082,16 @@ Ext4.define('LABKEY.targetedms.QCTrendPlotPanel', {
20812082
},
20822083

20832084
saveAnnotation: function (annotationType, description, annotationDate, win) {
2085+
// Format date as UTC string (YYYY-MM-DD) to avoid timezone conversion
2086+
const dateStr = Ext4.util.Format.date(annotationDate, 'Y-m-d');
2087+
20842088
LABKEY.Query.insertRows({
20852089
schemaName: 'targetedms',
20862090
queryName: 'QCAnnotation',
20872091
rows: [{
20882092
QCAnnotationTypeId: annotationType,
20892093
Description: description,
2090-
Date: annotationDate
2094+
Date: dateStr
20912095
}],
20922096
success: function () {
20932097
win.close();
@@ -2109,14 +2113,17 @@ Ext4.define('LABKEY.targetedms.QCTrendPlotPanel', {
21092113
},
21102114

21112115
updateAnnotation: function (annotationId, annotationType, description, annotationDate, win) {
2116+
// Format date as UTC string (YYYY-MM-DD) to avoid timezone conversion
2117+
const dateStr = Ext4.util.Format.date(annotationDate, 'Y-m-d');
2118+
21122119
LABKEY.Query.updateRows({
21132120
schemaName: 'targetedms',
21142121
queryName: 'QCAnnotation',
21152122
rows: [{
21162123
Id: annotationId,
21172124
QCAnnotationTypeId: annotationType,
21182125
Description: description,
2119-
Date: annotationDate
2126+
Date: dateStr
21202127
}],
21212128
success: function () {
21222129
win.close();

0 commit comments

Comments
 (0)