arrow-py / arrow

🏹 Better dates & times for Python
https://arrow.readthedocs.io
Apache License 2.0
8.62k stars 668 forks source link

Add "T" separator to FORMAT_RFC3339 #1138

Open krowbar opened 1 year ago

krowbar commented 1 year ago

Include "T" separator in the format string for FORMAT_RFC3339

Currently the FORMAT_RFC3339 does not include the "T" separator, but technically it is required. From https://www.rfc-editor.org/rfc/rfc3339#page-7

ISO 8601 states that the "T" may be omitted under some circumstances. This grammar requires the "T" to avoid ambiguity.

I realize that str() already returns the RFC3339 format with the "T".

krisfremen commented 1 year ago

hey @krowbar, str() returns ISO8601 which does have the "T", as per https://github.com/arrow-py/arrow/blob/1.2.3/arrow/arrow.py#L792

in order to not break backwards compatibility of people that might already be using this formatter, I'd say we can add another one, FORMAT_RFC3339_STRICT, to add the "T".

@jadchaar @anishnya @systemcatch thoughts?

conoremclaughlin commented 3 weeks ago

Chiming in to say this bit us. Expected the T as the most standard string format for datetimes now.