没有时区组件的 DateTime ISO 8601

DateTime ISO 8601 without timezone component

我一直在为我们的国际申请解析日期时间字符串。我 运行 遇到了一个我似乎找不到明确答案的解释问题。 是否应将不带时区组件的 ISO 8601 日期时间字符串视为当地时间?

根据 wikipedia(我不想以此作为我的业务决策的依据):

If no UTC relation information is given with a time representation, the time is assumed to be in local time.

但是,我无法通过 ISO 或任何其他普遍接受的真实来源找到支持文档。我发现的所有内容都在谈论如何处理本地时间的偏移量(例如 +/- 0500 等)。在这些情况下假设当地时间将对我有很大帮助,因为我的用户可以为所有地区提交相同的日期,而无需计算每个地区的具体偏移量。

例如:

2012-01-01T00:00:00 # Convert to local
2012-01-01T00:00:00Z # Zulu/UTC...don't convert

是否有针对无时区 ISO 8601 字符串的既定解释?

ISO 8601 的第 4.2.2 节给出了没有 TZ 指示符的示例,表示它们是当地时间。 4.2.4 表示 UTC 时间使用 'Z' 指示符。当然它总是提出问题 "local time where?"...

The zone designator is empty if use is made of local time in accordance with 4.2.2.2 through 4.2.2.4, it is the UTC designator [Z] if use is made of UTC of day in accordance with 4.2.4 and it is the difference-component if use is made of local time and the difference from UTC in accordance with 4.2.5.2.

如果没有时区指示符,日期时间字符串将被解释为本地时间 -- 但对于服务器来说是本地时间。

如果您的用户处于不同的时区,他们提交的没有 TZ 信息的日期将被错误地解释为您当地的 TZ 偏移量。