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

Using SubMonth for a month with 31 numbers causes parsing errors #187

Closed
hyisfine opened this issue Oct 12, 2023 · 3 comments
Closed

Using SubMonth for a month with 31 numbers causes parsing errors #187

hyisfine opened this issue Oct 12, 2023 · 3 comments
Labels
Bug Report a reproducible bug or regression

Comments

@hyisfine
Copy link

hyisfine commented Oct 12, 2023

image
@hyisfine hyisfine added the Bug Report a reproducible bug or regression label Oct 12, 2023
@hyisfine
Copy link
Author

对2023-07-31 使用SubMonth再使用EndOfMonth 期望的是2023-06-30。但是由于6月份没有31号,2023-07-31 使用SubMonth之后貌似会变成2023-07-01

@Issues-translate-bot
Copy link
Collaborator

The issue body's language is not English, translate it automatically, please use English next time. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Using SubMonth for 2023-07-31 and then EndOfMonth expects 2023-06-30. However, since there is no 31st in June, 2023-07-31 will appear to be 2023-07-01 after using SubMonth.

@gouguoyin
Copy link
Member

You can try this

Parse("2023-07-31").SubMonthNoOverflow().EndOfMonth().ToDateString() // 2023-06-30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report a reproducible bug or regression
Development

No branches or pull requests

3 participants