GlideDateTime getNumericValue() with 1 hour difference

Gilly
Tera Contributor

Hi, I have a PowerShell script to set the users account expiration date. Before that we have a small JavaScript step that does the following:

    var endDateGDT =  new GlideDateTime(inputs.datetime);
    var accountExpires = (endDateGDT.getNumericValue())
    outputs.datetime = accountExpires;

Example Input - 2024-08-25 15:00:00

 

Our PowerShell then does the following:

    [datetime]$origin = '1970-01-01Z'
    [double]$milliseconds = $AccountExpirationDate
    $expirationDateTime = $origin.addmilliseconds($milliseconds)

We've found a few instances where the JavaScript is providing the numeric value with an hour missing. I feel like this is something to do with DST but can't see how to ensure we get an accurate date and time.

 

When I run the JavaScript in background scripts (in the same instance) I get the correct date/time. The action step is running in the instance, running as system.

 

Any advice on why this is happening would be much appreciated!

0 REPLIES 0