Code Monkey home page Code Monkey logo

Comments (7)

gouguoyin avatar gouguoyin commented on August 25, 2024

After testing, in golang, 0001-01-01 00:00:00+0000 GMT is a zero value, but 0000-01-01 00:00:00+0000 GMT or 0002-01-01 00:00:00+0000 GMT is not

image

https://play.golang.com/p/Ozr7GaWc0sD

from carbon.

lesichkovm avatar lesichkovm commented on August 25, 2024

This looks very wrong. According to AI:

"0000-01-01 00:00:00" is not a valid date according to the most common date and time  standards. Here's why: 
Year Zero Doesn't Exist: Our calendar system doesn't have a year zero. There was no year 0 between 1 BC and 1 AD.

from carbon.

lesichkovm avatar lesichkovm commented on August 25, 2024

We should add support for '0001-01-01 00:00:00' to Carbon, as it is a valid datetime, and can be saved in i.e. MySQL. For instance, when getting the data from the database it reads as '0001-01-01 00:00:00', but once it is passed into Carbon it gets blank.

from carbon.

lesichkovm avatar lesichkovm commented on August 25, 2024

After testing, in golang, 0001-01-01 00:00:00+0000 GMT is a zero value, but 0000-01-01 00:00:00+0000 GMT or 0002-01-01 00:00:00+0000 GMT is not

Your tests will pass if you update the time layout:

https://play.golang.com/p/AUKnroJAxlj

from carbon.

gouguoyin avatar gouguoyin commented on August 25, 2024

After testing, in golang, 0001-01-01 00:00:00+0000 GMT is a zero value, but 0000-01-01 00:00:00+0000 GMT or 0002-01-01 00:00:00+0000 GMT is not

Your tests will pass if you update the time layout:

https://play.golang.com/p/AUKnroJAxlj

The layout does not match the time string,the layout contains a time zone, but the time string does not

from carbon.

lesichkovm avatar lesichkovm commented on August 25, 2024

Sorted by using 0002-01-01 00:00:00 which is the earliest valid date

from carbon.

gouguoyin avatar gouguoyin commented on August 25, 2024

V2.3.11 has been optimized and released

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.