Skip to content

Commit

Permalink
Merge pull request #19278 from jeclrsg/hpcc-32957-zap-report-invalid-…
Browse files Browse the repository at this point in the history
…date-formats

HPCC-32957 ECL Watch ZAP dialog invalid date formats
  • Loading branch information
GordonSmith authored Nov 8, 2024
2 parents 0594b5f + 35517aa commit 2d18715
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion esp/src/eclwatch/WUDetailsWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ define([
formatLogFilterDateTime: function (dateField, timeField, dateTimeField) {
if (dateField.value.toString() !== "Invalid Date") {
const d = new Date(dateField.value);
const date = `${d.getFullYear()}-${(d.getMonth() < 9 ? "0" : "") + parseInt(d.getMonth() + 1, 10)}-${d.getDate()}`;
const month = d.getMonth() + 1;
const day = d.getDate();
const date = `${d.getFullYear()}-${(month < 9 ? "0" : "") + month}-${(day < 9 ? "0" : "") + day}`;
const time = timeField.value.toString().replace(/.*1970\s(\S+).*/, "$1");
dateTimeField.value = `${date}T${time}.000Z`;
}
Expand Down
2 changes: 1 addition & 1 deletion esp/src/eclwatch/templates/WUDetailsWidget.html
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ <h2>
<input id="${id}EndDateTime" name="LogFilter_AbsoluteTimeRange_EndDate" type="hidden" />
<input id="${id}EndDate" title="${i18n.ToDate}:" name="EndDate" data-dojo-props="trim: true" required="required" data-dojo-type="dijit.form.DateTextBox" />
<input id="${id}EndTime" title="" name="EndTime" data-dojo-props="trim: true" value="T19:30:00" data-dojo-type="dijit.form.TimeTextBox" />
<input id="${id}RelativeTimeRangeBuffer" title="${i18n.RelativeTimeRange}" name="LogFilter_RelativeTimeRangeBuffer" colspan="2" data-dojo-type="dijit.form.TextBox" />
<input id="${id}RelativeTimeRangeBuffer" title="${i18n.RelativeTimeRange}" name="LogFilter_RelativeTimeRangeBuffer" value="43200" colspan="2" data-dojo-type="dijit.form.TextBox" />
<input id="${id}LineLimit" title="${i18n.LogLineLimit}" name="LogFilter_LineLimit" colspan="2" value="10000" data-dojo-type="dijit.form.TextBox" />
<input id="${id}LineStartFrom" title="${i18n.LogLineStartFrom}" name="LogFilter_LineStartFrom" value="0" colspan="2" data-dojo-type="dijit.form.TextBox" />
<select id="${id}SelectColumnMode" title="${i18n.ColumnMode}" name="LogFilter_SelectColumnMode" colspan="2" data-dojo-type="dijit.form.Select">
Expand Down
11 changes: 6 additions & 5 deletions esp/src/src-react/components/forms/ZAPDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,12 @@ export const ZAPDialog: React.FunctionComponent<ZAPDialogProps> = ({
}
for (const key in logFilter) {
if (key === "AbsoluteTimeRange") {
const startDate = logFilter.AbsoluteTimeRange.StartDate ? new Date(logFilter.AbsoluteTimeRange.StartDate).toISOString() : "";
const endDate = logFilter.AbsoluteTimeRange.EndDate ? new Date(logFilter.AbsoluteTimeRange.EndDate).toISOString() : "";
if (startDate && endDate) {
formData.append("LogFilter_AbsoluteTimeRange_StartDate", startDate);
formData.append("LogFilter_AbsoluteTimeRange_EndDate", endDate);
const startDate = logFilter.AbsoluteTimeRange.StartDate ? new Date(logFilter.AbsoluteTimeRange.StartDate) : null;
let endDate = logFilter.AbsoluteTimeRange.EndDate ? new Date(logFilter.AbsoluteTimeRange.EndDate) : null;
if (startDate) {
endDate = endDate === null ? new Date(startDate.getTime() + (8 * 3600 * 1000)) : endDate;
formData.append("LogFilter_AbsoluteTimeRange_StartDate", startDate.toISOString());
formData.append("LogFilter_AbsoluteTimeRange_EndDate", endDate.toISOString());
delete logFilter.RelativeTimeRangeBuffer;
}
} else {
Expand Down

0 comments on commit 2d18715

Please sign in to comment.