Coder Social home page Coder Social logo

Comments (9)

gouguoyin avatar gouguoyin commented on June 19, 2024 1

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.

gouguoyin avatar gouguoyin commented on June 19, 2024

Thank you for your feedback. Here is the reply to your feedback.

from carbon.

gouguoyin avatar gouguoyin commented on June 19, 2024

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";

php

$date=date_create_from_format("j-M-Y","25-Sep-2016");

c#

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.

gouguoyin avatar gouguoyin commented on June 19, 2024

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.

andig avatar andig commented on June 19, 2024

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.

gouguoyin avatar gouguoyin commented on June 19, 2024

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.

gouguoyin avatar gouguoyin commented on June 19, 2024

If possible, help me review whether the German translation resources de.json are correct.

from carbon.

andig avatar andig commented on June 19, 2024

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.

gouguoyin avatar gouguoyin commented on June 19, 2024

Thank you very much, can you create a pr for de.json?

from carbon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.