You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem or limitation you are having in your project
There's no built-in method to convert ISO 8601 timestamps to other date formats supported by Godot (date dictionaries and UNIX timestamps).
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add OS.get_iso8601_time_from_datetime() and OS.get_datetime_from_iso8601_time() methods.
We already have similar methods to convert a date dictionary to an UNIX timestamp and vice versa.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
These methods should be added in the OS singleton next to the other date conversion methods.
If this enhancement will not be used often, can it be worked around with a few lines of script?
It can be implemented easily using a script:
## Parses an ISO-8601 date string to a datetime dictionary that can be parsed by Godot.funcparse_date(iso_date: String) ->Dictionary:
vardate:=iso_date.split("T")[0].split("-")
vartime:=iso_date.split("T")[1].trim_suffix("Z").split(":")
return {
year=date[0],
month=date[1],
day=date[2],
hour=time[0],
minute=time[1],
second=time[2],
}
func_ready() ->void:
print(parse_date("2021-01-11T15:00:00Z"))
However, given that most people will need this when they interact with a REST API, I'd argue this should be present in core.
Is there a reason why this should be core and not an add-on in the asset library?
Other programming languages such as JavaScript already feature this in their standard library.
The text was updated successfully, but these errors were encountered:
Describe the project you are working on
The Godot editor 🙂
Describe the problem or limitation you are having in your project
There's no built-in method to convert ISO 8601 timestamps to other date formats supported by Godot (date dictionaries and UNIX timestamps).
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add
OS.get_iso8601_time_from_datetime()
andOS.get_datetime_from_iso8601_time()
methods.We already have similar methods to convert a date dictionary to an UNIX timestamp and vice versa.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
These methods should be added in the OS singleton next to the other date conversion methods.
If this enhancement will not be used often, can it be worked around with a few lines of script?
It can be implemented easily using a script:
However, given that most people will need this when they interact with a REST API, I'd argue this should be present in core.
Is there a reason why this should be core and not an add-on in the asset library?
Other programming languages such as JavaScript already feature this in their standard library.
The text was updated successfully, but these errors were encountered: