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

Is it possible a month is negative or out of 1..=12? #130

Open
tisonkun opened this issue Sep 11, 2024 · 1 comment
Open

Is it possible a month is negative or out of 1..=12? #130

tisonkun opened this issue Sep 11, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@tisonkun
Copy link

Hi @BurntSushi.

I noticed that month method is defined as:

    #[inline]
    pub fn month(&self) -> i8 {
        self.date().month()
    }

I wonder if it's possible month is negative or out of 1..=12?

@BurntSushi
Copy link
Owner

No, it isn't possible. We should add that guarantee to the docs. And for other similar methods like day.

But it is mentioned in the constructor for civil::Date: https://docs.rs/jiff/latest/jiff/civil/struct.Date.html#method.new

@BurntSushi BurntSushi added the documentation Improvements or additions to documentation label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants