-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TimeType subtraction using promote #49700
Conversation
I don't think this is necessarily a good change - conversion to a |
That's fair. Maybe this should be limited to |
I'm not sure. It depends on what you intended to do with the change originally - you gave no reasoning for it after all 🤷 |
Here’s my reasoning: I use an internal type that subtypes AbstractDateTime with some extra functionality not currently available in DateTime. I would like to be able to subtract DateTime and my custom internal type that subtypes AbstractDateTime. We might want this to be handled more generally for all TimeTypes, or may want to limit it to AbstractDateTime. I don’t have a strong opinion here. |
You're free to implement @quinnj can you clarify why you merged this? Do we have an official stance on which time a |
Why is it a problem to promote to midnight? Do you have any concrete examples where that would be "bad" by doing it implicitly and why it would be better to do it explicitly? I merged because I feel like I remember that we already have places where we do this kind of "midnight assumption" and I've never heard of it biting anyone or there being anything wrong in practice, so I'm just curious why the pushback? I'm certainly up for discussing if this is causing real problems for people somewhere. |
We have it in the
which shouldn't exist. The issue is that in timezone aware code, there is no one "midnight", especially not in DST aware code, where there may be more than one midnight (or no midnight at all - the whole list is a good source, and links to more sources). There's also boatloads of discussions (and controversial & differing opinions) in this python discussion. There's also the issue that ISO-8601 actually defines two midnights per day (see here): 00:00, for the start of the day, and 24:00, for the end of the day. I don't think we handle either correctly right now ( I recognize that Base itself is oblivious to timezones (which I think is a bit of a mistake), but I think it would be a bigger mistake to encourage coding patterns that encourage being oblivious to the complexity of time. |
I'm not sure I'm really following the arguments/logic here. The approach in Dates stdlib is to keep things simple, and the I also realize there are tons of these more esoteric micro-cases where time/dates/timezones can be super weird. We purposely didn't want to have to deal w/ as much of that as possible in the stdlib because they introduce so much complexity and 99% of use-cases don't want/need to deal with that. And that's also why the package ecosystem is so great! You can have all these super-specific, nuanced Date packages that take all this stuff into account. Does the stdlib need improvement? Sure. And we should open specific issues for concrete things to improve. But on a high-level, I'm still of the opinion that the |
All of that is fine and A-Ok - I'm not saying we should get rid of
Great, let's discuss the stance of Base about at what time |
Sounds good; thanks. |
I vote to merge #49805 but I’m okay reverting too if needed. |
No description provided.