[JAVA-5044] $dateToString aggregation with timezone outputs invalid ISO8601 string Created: 27/Jun/23  Updated: 11/Jul/23

Status: Backlog
Project: Java Driver
Component/s: Builders
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: PM Bot Assignee: Maxim Katcharov
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Issue split
Server Compat: 7.1
Quarter: FY24Q3
Upstream Changes Summary:

DRIVERS-2620:
The current default behavior of MongoDB's $dateToString aggregation expression is incorrect because it violates ISO 8601. (It tacks on a "Z" to the end of the string by default, which implies that it is in UTC [1], but in actually it's in the timezone of the local server.)

This ticket proposes a number of routes to change the default behavior of $dateToString to bring it into compliance with ISO 8601.

[1] https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_(UTC)

1. If the query specifies a date format string, this is used.
2. If no format string is specified, then
a. If no timezone is specified or the UTC timezone is explicitly specified, the default format will continue to include the 'Z' suffix (yyyy-mm-ddThh:mm:ss.uuuZ).
b. If a non-UTC timezone is specified, the default format will omit the 'Z' suffix (yyyy-mm-ddThh:mm:ss.uuu).

Case 2b is the only change from prior behavior.

This change was delivered in 7.1.0-rc0 and will NOT be backported.

Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

This ticket was split from DRIVERS-2620, please see that ticket for a detailed description.


Generated at Thu Feb 08 09:03:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.