json->dict switch in UI (flow->run tab) has ...
# prefect-ui
j
json->dict switch in UI (flow->run tab) has some unexpected behaviour. 🧵
1. set a datetime-like value for a Parameter, in JSON. e.g.
Copy code
{
  "last_modified_begin": "2021-12-12T12:12:12+00:00",
  "last_modified_end": "2021-10-10T10:10:10+00:00"
}
2. hit
DICT
3. Note that dates and times have changed 😞
4. hit JSON
5. note that dates and times are still changed
Copy code
{
  "last_modified_begin": "2021-12-12T12:12:00+00:00",
  "last_modified_end": "2021-10-31T01:10:00+00:00"
}
currently checking that the original dates are used if I don't click those buttons...
a
the UI infers your time zone based on your UI settings, that’s why you see this date conversion. Probably easier to switch to String?
I also asked the UI team, will get back to you
👍 1
j
I don't think this is a timezone issue, but perhaps I misunderstand. In this example,
2021-10-10
becomes
2021-10-31
Thanks @Anna Geller
a
no worries, I’ll get back to you when I hear back from the UI team
j
Hi @John Shearer - thanks for telling us about your experience. I'm trying to replicate that date switch you experienced and can't.
Would you mind sharing what timezone you are in?
j
GMT
thanks @Jenny
j
Thanks. Let me look into that a bit further.
👍 1
Hmm… I’m still not able to replicate that odd switch from 10 to 31 and I can’t see any obvious reason for it in the code. My guess is there's some oddity in time zone/and the moment.js library we're using. I’ll open a ticket.
🙏 2
j
I just tried this on a helloworld flow (from @Anna Geller's ECS demo), and have some more test cases, as well as a perf issue. just writing this up
For reference, this is Google Chrome Version 96.0.4664.110 (Official Build) (64-bit), on Win10, running on cloud.perfect.io
The incorrect results only occur for some months (05-10 - may-oct, inclusive), independent from the year. When calculating, if the result will be incorrect it takes much longer (2-3 minutes for 12 dates). Correct results come back instantaneously. Please see attached for the testing I've done. Hope it helps
🙏 1
🚀 1
dropping the tz adjust doesn't make any difference afaict, and the resulting json adds it back.
j
Thanks for the extra info @John Shearer
🦜 1
This is very strange and I still cannot replicate. Can I ask you for a bit more info/investigation? • Have you set your timezone from the user menu or is set at 'Local'? (You can find the timezone selector by clicking on the avatar in the top right corner and then selecting Account Settings and Profile). • If you explicitly set your timezone to GMT in the user menu, do you still see the odd conversions? I'm not convinced that the timezone is having an impact here since its from a date time string but I want to rule it out as it's the only thing that I can see that would explain you seeing this issue and me not being able to replicate it.