Comments (9)
v2.2.3
released and added FromStdTime
alias method of Time2Carbon
method and ToStdTime
alias method of Carbon2Time
method, Time2Carbon
and Carbon2Time
will be removed in the future.
from carbon.
Thank you for your feedback. Here is the reply to your feedback.
from carbon.
For the naming of carbon.CreateFromXxx
, I have referred to the naming rules of other languages or third party libraries such as
carbon
$year = 2000; $month = 4; $day = 19;
$hour = 20; $minute = 30; $second = 15; $tz = 'Europe/Madrid';
echo Carbon::createFromDate($year, $month, $day, $tz)."\n";
echo Carbon::createMidnightDate($year, $month, $day, $tz)."\n";
echo Carbon::createFromTime($hour, $minute, $second, $tz)."\n";
echo Carbon::createFromTimeString("$hour:$minute:$second", $tz)."\n";
echo Carbon::create($year, $month, $day, $hour, $minute, $second, $tz)."\n";
$date=date_create_from_format("j-M-Y","25-Sep-2016");
COMVariant theDay;
theDay = COMVariant::createFromDate(today());
info(theDay.toString());
In addition, in terms of English grammar, carbon.CreateFromXxx
is more legal and semantic than carbon.FromXxx
. If carbon.CreateFromXxx
is renamed as carbon.FromXxx
, carbon.ParseByXxx
is renamed as carbon.ByXxx
?
from carbon.
Carbon.Carbon2Time
is not named carbon.FromTime
to avoid ambiguity with carbon.CreateFromTime
Carbon.Time2Carbon
is not named carbon.ToTime
to avoid ambiguity with carbon.ToTimeString
and carbon.Time
In addition,Carbon.Carbon2Time
or Carbon.Time2Carbon
is the conversion between two different structures of carbon and golang time. I don't think it is appropriate to use Carbon.FromTime
or Carbon.ToTime
from carbon.
I did not mean to imply that the naming is wrong or not consistent with the carbon ancestry. What I was trying to say is that it feels alien for me as a somewhat experienced Go developer. Your milage may vary of course.
Carbon.Carbon2Time is not named carbon.FromTime to avoid ambiguity with carbon.CreateFromTime
All Create
methods assemble a time. FromTime
would be a straight conversion between both types.
Carbon.Time2Carbon is not named carbon.ToTime to avoid ambiguity with carbon.ToTimeString and carbon.Time
I meant to suggest carbon.FromTime
. The idiomatic way in Go to convert to string seems to be String()
. With different formats probably TimeString()
etc. I've not found examples of prefixing those with To
.
I don't think it is appropriate to use Carbon.FromTime or Carbon.ToTime
It would take away the "stuttering" which is a comment that regularly appears in Go repo's issue discussion.
All that said, no need to change anything. I was just sharing my experience, happy to have this issue closed if you want.
from carbon.
Thanks for sharing your experience, the naming of method is really a headache, maybe GPT-AI can solve this problem in the future.
from carbon.
If possible, help me review whether the German translation resources de.json are correct.
from carbon.
LGTM. Depending on context now
is jetzt
. gerade eben
is the moment that has just passed while jetzt
is now
. Both may be valid:
- it has happened just now
gerade eben
- it is happening right now
jetzt
from carbon.
Thank you very much, can you create a pr for de.json?
from carbon.
Related Issues (20)
- Using SubMonth for a month with 31 numbers causes parsing errors HOT 3
- Why choose Sunday as the week of development HOT 1
- About DiffAbsInMonths HOT 4
- Timezone issue daylight saving and StartOfMonth HOT 4
- Cannot use v2.2.12 in GoFrame framework HOT 2
- What is the best way to mock carbon in unit testing? HOT 11
- Is there any consideration to support converting the lunar calendar to the Gregorian calendar? HOT 3
- [Feature Request] Please support MJD format in Carbon HOT 2
- 咨询关于Now函数入参的问题(About the Now function parameter issue) HOT 1
- `ToWeekString()` ignores `SetWeekStartsAt()`
- The current JSON serialization format is `2006-01-02 15:04:05.999999999`. Is user-defined configuration allowed? HOT 5
- "2023-11-08T09:52:48" not support? HOT 5
- Rename the func such as `carbon.CreateFromDate()`. HOT 13
- ParseByFormat not supported "U" format HOT 3
- json is reversed, causing the diff series method to be abnormal. What should I do in this case? HOT 5
- My local time is Asia/Shanghai, But the time from the database is UTC HOT 6
- Default JSON template settings HOT 1
- Wrong zodiac sign HOT 2
- Starting from v2.3.0, after removing the series of methods such as DateTime, it is extremely inconvenient to insert the birthday (Y-m-d) field with gorm now. What is the best practice HOT 11
- build for windows_386 (untyped int constant) overflows int HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from carbon.