@Heloisa Paiva are you aware of a way to take a Python dict object and cast it as a %DynamicObject in ObjectScript?
- Log in to post comments
@Heloisa Paiva are you aware of a way to take a Python dict object and cast it as a %DynamicObject in ObjectScript?
I was able to do
return json.dumps(response,default=str)
default=str handled some date stuff that wasn't parsing correctly. This returns a raw string that can be s obj={}.%FromJSON(rawJson)
Now I'm trying to deal with a Python stream . . . that builtins.help method is helpful.
I tend to use $SYSTEM.SQL.Functions.DATEADD()
You can use this to add seconds, minutes, hours, days, etc. to date. The date/time should be ODBC e.g "2025-05-21T14:52:47.986"
There may be other ways, but this is how I do it to deal with UTC offsets.
This comment shows a quick way to convert to ODBC
https://community.intersystems.com/post/convert-numeric-expression20201…
You may have to tweak a little.
USER>w $tr("abcd-ef-gh ij:kl:00","abcdefghijkl",20250518144529)
2025-05-18 14:45:00
USER>s time=$tr("abcd-ef-gh ij:kl:00","abcdefghijkl",20250518144529)
USER>w time
2025-05-18 14:45:00
USER>s time=$SYSTEM.SQL.Functions.DATEADD("hh",-6,time)
USER>w time
2025-05-18 08:45:00
I am bad at full thoughts evidently: do read on timezones and DST though so you don't hit any traps - https://docs.intersystems.com/iris20251/csp/docbook/DocBook.UI.Page.cls…
It appears in your example you need a better way to determine if you are in DST or standard. You can't just go off of month and you also might be dealing with a region that doesn't acknowledge DST.