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

Rename the func such as carbon.CreateFromDate(). #205

Closed
tanqiangyes opened this issue Dec 5, 2023 · 13 comments
Closed

Rename the func such as carbon.CreateFromDate(). #205

tanqiangyes opened this issue Dec 5, 2023 · 13 comments

Comments

@tanqiangyes
Copy link

Feature Request

Is your feature request related to a problem? Please describe:
When I use carbon.CreateFromDate(2023,1,1), I think I will get the time 2023-01-01 00:00:00, but actually I get the time 2023-01-01 Current Hour: Current Minutes: Current Seconds Current Nanoseconds. I think this naming "CreateFromDate" is confusing and we should change it to something that describes its function more precisely, like " CreateFromDateUseCurrentHMS".

Describe the feature you'd like:
Rename the func such as carbon.CreateFromDate().

Describe alternatives you've considered:
Yes, we can use carbon.CreateFromDateTimeNano,but for a new user, CreateFromDate is still disorienting, which will cause unexpected bugs in their work

Teachability, Documentation, Adoption, Migration Strategy:
With this renaming, users will know exactly what time they are using, and will not have a series of bugs caused by the use of this package, which can be implemented in a new version without affecting the old version of the code.

@gouguoyin
Copy link
Collaborator

Thank you for your feedback, I will seriously consider it.

@tanqiangyes
Copy link
Author

If you need help, I'd be happy to provide it.

@tanqiangyes
Copy link
Author

If you don't want to change the name, then perhaps the notes should be written more clearly? Because as it stands now, the notes don't describe what the functions do very clearly.

@gouguoyin
Copy link
Collaborator

I also hesitated when I first named it, CreateFromDate is to be consistent with CreateFromTime, in CreateFromTime, the year, month, and day are taken from current time, so, all omitted values are taken to the current time.

@gouguoyin
Copy link
Collaborator

Yesterday and Tomorrow have the same logic,hours, minutes and seconds are taken from the current time.

@gouguoyin
Copy link
Collaborator

2023-01-01 Current Hour: Current Minutes: Current Seconds Current Nanoseconds? No Current Nanoseconds
image

@dromara dromara deleted a comment from Issues-translate-bot Dec 5, 2023
@gouguoyin
Copy link
Collaborator

Currently can use the following methods
carbon.CreateFromDate(2023,1,1).StartOfDay() // 2023-01-01 00:00:00

@tanqiangyes
Copy link
Author

I know that I can also use carbon.CreateFromDateTimeNano. But the confusing nature of function names is still there.

@tanqiangyes
Copy link
Author

image
Nanoseconds exist in your concrete realization.

2023-01-01 Current Hour: Current Minutes: Current Seconds Current Nanoseconds? No Current Nanoseconds image

@dromara dromara deleted a comment from Issues-translate-bot Dec 5, 2023
@gouguoyin
Copy link
Collaborator

What should be the year, month and day in CreateFromTime? 0000-00-00 or currentYear-currentMonth-currentDay

@tanqiangyes
Copy link
Author

What should be the year, month and day in CreateFromTime? 0000-00-00 or currentYear-currentMonth-currentDay

currentYear-currentMonth-currentDay maybe this, but nobody can kown this from func name or func comment

@tanqiangyes
Copy link
Author

tanqiangyes commented Dec 5, 2023

What should be the year, month and day in CreateFromTime? 0000-00-00 or currentYear-currentMonth-currentDay

As you said, is it 0000-00-00 or currentYear-currentMonth-currentDay which is unknown to the user?

@gouguoyin
Copy link
Collaborator

Optimized in v2.3.0
image

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

No branches or pull requests

2 participants