Skip to content

Add wasHole property to DateTime#1753

Open
icambron wants to merge 2 commits intomoment:masterfrom
icambron:mark-hole-times
Open

Add wasHole property to DateTime#1753
icambron wants to merge 2 commits intomoment:masterfrom
icambron:mark-hole-times

Conversation

@icambron
Copy link
Contributor

When you create a DateTime on a hole (i.e. a local time that does not exist), Luxon detects that and bumps it forward. The issue is that we never tell the user we did this. This PR adds a wasHole property to the DateTime to signal that's what happened.

@diesieben07
Copy link
Collaborator

I am not sure I am a fan of the API here, because this really is not a property of the DateTime (which manifests in the fact that you have to make sure to remove it on setZone, etc.).
But I cannot think of a better API either, because basically any factory would have to return this. I will think about it some more though before I merge this.

@icambron
Copy link
Contributor Author

icambron commented Feb 7, 2026

I agree it's more like metadata for the factory process than a property of the datetime but there isn't a great way to signal that unless we return more complicated objects from those factory functions. Which doesn't seem reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants