Datetime value convert on variable save

I have created a variable and entered this text ‘9999-12-31T23:59:59Z’ (without the ') when i save the variable its converted to ‘12/31/9999 11:59:59 PM’ I have tried putting # in front of the var but that persists when the variable is used. Is there a way to have octopus not update the value and use what i set?
server build 3.3.1
thanks
tim

Hi Tim,

Thanks for getting in touch. Unfortunately our deserialiser does this when extracting information from the DB. This touches pretty much everything in Octopus, so It wouldn’t be a quick fix.

I’ve created a Uservoice sugestion so users that want this to change can vote it up. It’ll be the best way for us to see how many users would be behind this idea to then see if we could implement it. Could you please drop by and add some votes to it? I’ve already added a reference of this thread on the suggestion.

Best regards,
Dalmiro

There is no reason why a deserializer should change string data. Even though this string has date/time data in it, it is still a string with a specific (sortable) format.

There should be a way to indicate that the variable should be handled as a string and NOT as a date/time (that would fix this problem)! This is a well-established, precedented data handling behavior (see Excel, for example).

There should also be a way to specify what format each actual date/time field should use. This is also typical, well-established, precedented functionality.

Another point to make:

This data conversion is a true bug. It is currently currupting the value of the variable by losing the time-zone information. As formatted, the converted value will be interpreted as local time by most date/time processors while the original data was UTC.

This is a critical issue for production systems.

Hi BIll,

Thanks for reaching out. We’ve discussed this with the team and we decided that we’re gonna re-investigate it a bit further. We are currently working on a feature to have strongly-typed variables, and there’s a chance we might be able to use that feature to add some sort of control over the format of that value (ideally not formatting it at all).

I cannot give you a specifics for when this’ll be implemented, but I encourage you to follow this github issue as we’ll be updating it as we start working on this.

Best regards,
Dalmiro

Dalmiro,
Pleased extend my thanks to your team for following up with this issue.
Bill.

We use the below workaround to avoid the issue. Just attach an empty string variable to your DateTime string, then the Octopus will not convert it to DateTime.

Name Value
ExecutionTime #{empty}2016-10-17T00:00:00Z
empty

Hi all,
Just a brief update to this issue.
With some recent updates to Octostache, our variable replacement library. A better work around is now available.

Since the serialization hebaviour is shared across the system, we were hesitant to just change how that works. Instead we have introduced the ability for format your variables with the variable substitution syntax and the new format filter.

With these changes you can set your date to 2016-10-17T00:00:00Z (expecting of course for it to be saved in the long date format) and then use the substitution binding like #{MyDate | Format O} to have it print back out in the round-trip format.

Thanks again for your patience.
Rob