Easy Chart Dates via Button

I don't know why this isn't working. I want a button to automatically set the historical chart to the last X hours (X) being a custom property on the button, bound to a dropdown's selected value.

now = system.date.now()
old = system.date.addHours(now, (-1) * event.source.hours)

event.source.parent.startTime = old
event.source.parent.endTime = now

Start Date on the chart is bound to startTime and End Date is bound to endTime.

Why am I getting 1969 dates - and they're equal?

So this is working on one gateway at not another... interesting.

I copied the XML for the window to another gateway designer on my local machine and it works...

Only difference is Win 10 and Win 11

Running system.date.now() on the first gateway in the script console returns the correct date.

Re-opening the window has fixed the issue.

1 Like