Skip to content
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

Add mention and example of validity behavior in the intro docs #1155

Open
philvarner opened this issue Mar 8, 2022 · 0 comments
Open

Add mention and example of validity behavior in the intro docs #1155

philvarner opened this issue Mar 8, 2022 · 0 comments

Comments

@philvarner
Copy link

Is your feature request related to a problem? Please describe.

Documentation for error behavior is hard to find. It's buried in the Validity section, which a new user is unlikely to know to look there. There's nothing in the API docs that mention it for methods like DateTime.fromISO

Describe the solution you'd like

Include near the beginning of the documentation text and an example of the use of isValid, etc. when an invalid DateTime is created

Also a mention exceptions are off by default (which is a great design decision, just not one that typical for most libraries)

const dt = DateTime.fromISO('invalid')
if (dt.isValid) {
...
}

Describe alternatives you've considered

n/a

Additional context

The validity behavior is described well here: https://moment.github.io/luxon/#/validity
but is hard for a new user to find. Especially with methods that have a high likelyhood of producing an error due to malformed input like DateTime.parseISO, the error behavior should be introduced at the beginning of the documentation.

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

No branches or pull requests

2 participants