Fix timezone display: append Z suffix to UTC dates in API responses
JS new Date() was parsing dates without Z as local time, showing UTC values as-is. Adding Z suffix tells JS the dates are UTC so it converts to the user's local timezone automatically. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
214c65adb2
commit
15e76c7170
5 changed files with 8 additions and 8 deletions
|
|
@ -207,9 +207,9 @@ try {
|
||||||
order["Tip"] = tip;
|
order["Tip"] = tip;
|
||||||
order["Total"] = total;
|
order["Total"] = total;
|
||||||
order["Notes"] = qOrder.Remarks;
|
order["Notes"] = qOrder.Remarks;
|
||||||
order["CreatedOn"] = dateTimeFormat(qOrder.AddedOn, "yyyy-mm-dd HH:nn:ss");
|
order["CreatedOn"] = dateTimeFormat(qOrder.AddedOn, "yyyy-mm-dd'T'HH:nn:ss") & "Z";
|
||||||
order["SubmittedOn"] = len(qOrder.SubmittedOn) ? dateTimeFormat(qOrder.SubmittedOn, "yyyy-mm-dd HH:nn:ss") : "";
|
order["SubmittedOn"] = len(qOrder.SubmittedOn) ? dateTimeFormat(qOrder.SubmittedOn, "yyyy-mm-dd'T'HH:nn:ss") & "Z" : "";
|
||||||
order["UpdatedOn"] = len(qOrder.LastEditedOn) ? dateTimeFormat(qOrder.LastEditedOn, "yyyy-mm-dd HH:nn:ss") : "";
|
order["UpdatedOn"] = len(qOrder.LastEditedOn) ? dateTimeFormat(qOrder.LastEditedOn, "yyyy-mm-dd'T'HH:nn:ss") & "Z" : "";
|
||||||
order["Customer"] = customer;
|
order["Customer"] = customer;
|
||||||
order["ServicePoint"] = servicePoint;
|
order["ServicePoint"] = servicePoint;
|
||||||
order["LineItems"] = lineItems;
|
order["LineItems"] = lineItems;
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ try {
|
||||||
"OrderTypeName": orderTypeName,
|
"OrderTypeName": orderTypeName,
|
||||||
"StatusID": row.StatusID,
|
"StatusID": row.StatusID,
|
||||||
"StatusName": statusName,
|
"StatusName": statusName,
|
||||||
"SubmittedOn": dateTimeFormat(row.SubmittedOn, "yyyy-mm-dd HH:nn:ss"),
|
"SubmittedOn": dateTimeFormat(row.SubmittedOn, "yyyy-mm-dd'T'HH:nn:ss") & "Z",
|
||||||
"ServicePointID": row.ServicePointID,
|
"ServicePointID": row.ServicePointID,
|
||||||
"Name": len(trim(row.Name)) ? row.Name : "",
|
"Name": len(trim(row.Name)) ? row.Name : "",
|
||||||
"Name": len(trim(row.Name)) ? row.Name : "",
|
"Name": len(trim(row.Name)) ? row.Name : "",
|
||||||
|
|
|
||||||
|
|
@ -134,14 +134,14 @@ try {
|
||||||
createdAt = "";
|
createdAt = "";
|
||||||
try {
|
try {
|
||||||
if (!isNull(row.AddedOn) && len(trim(row.AddedOn))) {
|
if (!isNull(row.AddedOn) && len(trim(row.AddedOn))) {
|
||||||
createdAt = dateTimeFormat(row.AddedOn, "yyyy-mm-dd'T'HH:nn:ss");
|
createdAt = dateTimeFormat(row.AddedOn, "yyyy-mm-dd'T'HH:nn:ss") & "Z";
|
||||||
}
|
}
|
||||||
} catch (any de) { createdAt = ""; }
|
} catch (any de) { createdAt = ""; }
|
||||||
|
|
||||||
completedAt = "";
|
completedAt = "";
|
||||||
try {
|
try {
|
||||||
if (row.StatusID >= 4 && !isNull(row.LastEditedOn) && len(trim(row.LastEditedOn))) {
|
if (row.StatusID >= 4 && !isNull(row.LastEditedOn) && len(trim(row.LastEditedOn))) {
|
||||||
completedAt = dateTimeFormat(row.LastEditedOn, "yyyy-mm-dd'T'HH:nn:ss");
|
completedAt = dateTimeFormat(row.LastEditedOn, "yyyy-mm-dd'T'HH:nn:ss") & "Z";
|
||||||
}
|
}
|
||||||
} catch (any de) { completedAt = ""; }
|
} catch (any de) { completedAt = ""; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ try {
|
||||||
"Direction": qRating.Direction,
|
"Direction": qRating.Direction,
|
||||||
"Title": qRating.Title,
|
"Title": qRating.Title,
|
||||||
"ForUserName": trim(qRating.ForFirstName & " " & qRating.ForLastName),
|
"ForUserName": trim(qRating.ForFirstName & " " & qRating.ForLastName),
|
||||||
"ExpiresOn": dateTimeFormat(qRating.ExpiresOn, "yyyy-mm-dd HH:nn:ss")
|
"ExpiresOn": dateTimeFormat(qRating.ExpiresOn, "yyyy-mm-dd'T'HH:nn:ss") & "Z"
|
||||||
};
|
};
|
||||||
|
|
||||||
// Include appropriate questions based on direction
|
// Include appropriate questions based on direction
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ try {
|
||||||
"ActivationWithheldCents": row.ActivationWithheldCents,
|
"ActivationWithheldCents": row.ActivationWithheldCents,
|
||||||
"NetTransferCents": row.NetTransferCents,
|
"NetTransferCents": row.NetTransferCents,
|
||||||
"Status": row.Status,
|
"Status": row.Status,
|
||||||
"CreatedAt": dateTimeFormat(row.CreatedAt, "yyyy-MM-dd'T'HH:nn:ss")
|
"CreatedAt": dateTimeFormat(row.CreatedAt, "yyyy-MM-dd'T'HH:nn:ss") & "Z"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue