[DOCS-11444] Docs for SERVER-30523: dateFromParts should not reject "out-of-range" numbers for date/time properties Created: 13/Mar/18  Updated: 29/Oct/23  Resolved: 18/Jun/18

Status: Closed
Project: Documentation
Component/s: Server
Affects Version/s: None
Fix Version/s: 3.7.2

Type: Task Priority: Major - P3
Reporter: Kay Kim (Inactive) Assignee: Kay Kim (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-30523 dateFromParts should not reject "out-... Closed
Participants:
Days since reply: 5 years, 34 weeks, 2 days ago
Epic Link: DOCS: 4.0 Server
Story Points: 0.5

 Description   

Scope of changes:

https://docs.mongodb.com/manual/reference/operator/aggregation/dateFromParts/index.html should be updated to indicate that month, day, etc can be higher or lower than previous limits and correct date will be calculated.

Also example can/should be added showing how to get last day of previous month or year (using 0 day) or how subtracting allows calculating via date intervals.

Impact to other docs outside of this product:

none

MVP:

Resources:

Engineering Ticket Description:

Currently $dateFromParts will handle appropriately a day that's bigger than largest day in the specified month (i.e. year:2017, month:2, day:30 correctly becomes "2017-03-02" since there are only 28 days in February) but if day is >31 it gives an error. Same for month>12.

”‘day’ must evaluate to an integer in the range 1 to 31, found 32"

Instead it should just construct appropriate date (so 2017, 2, 32 is "2017-03-03" and 2017 month 13 is January of 2018. This allows simple construction of dates that are X days after given date or Y months after given date, etc.



 Comments   
Comment by Githook User [ 18/Jun/18 ]

Author:

{'username': 'kay-kim', 'name': 'kay', 'email': 'kay.kim@10gen.com'}

Message: DOCS-11444 dateFromParts and value range
Branch: master
https://github.com/mongodb/docs/commit/75db62321490ca8ca4c50b2ed38b18a46c90b0d1

Generated at Thu Feb 08 08:02:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.