Comments (7)
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://private-user-images.githubusercontent.com/13517412/318456042-2a0e9982-6864-43b0-99c6-4847428e52fa.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTY0MTk2MTYsIm5iZiI6MTcxNjQxOTMxNiwicGF0aCI6Ii8xMzUxNzQxMi8zMTg0NTYwNDItMmEwZTk5ODItNjg2NC00M2IwLTk5YzYtNDg0NzQyOGU1MmZhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTIyVDIzMDgzNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThhYmNhYjFlMGM5MjMwZDEzZmE4ODI2MmI1MTczMDNhMGQxMjlmZTY4MjI5ODM0ZTUzYWJlOTEwZmE2Y2Y1OTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.k6LxX2ji2Ewo0z1R-uT_BRebEwDYYLU3Q9CivS10sZk)
https://play.golang.com/p/Ozr7GaWc0sD
from carbon.
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.
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.
After testing, in golang,
0001-01-01 00:00:00+0000 GMT
is a zero value, but0000-01-01 00:00:00+0000 GMT
or0002-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.
After testing, in golang,
0001-01-01 00:00:00+0000 GMT
is a zero value, but0000-01-01 00:00:00+0000 GMT
or0002-01-01 00:00:00+0000 GMT
is notYour tests will pass if you update the time layout:
The layout does not match the time string,the layout contains a time zone, but the time string does not
from carbon.
Sorted by using 0002-01-01 00:00:00 which is the earliest valid date
from carbon.
V2.3.11 has been optimized and released
from carbon.
Related Issues (20)
- `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
- How to get time.Duration in two carbon instances? ? HOT 1
- ParseByFormat fails to detect location Location HOT 2
- cannot parse string null HOT 3
- DiffAbsInDuration must upgrade go version to 1.9+ HOT 3
- Can you add the 1.5.5 tag? HOT 4
- How to loadTag a slice list? HOT 1
- IsToday()、IsYesterday()、IsTomorrow()in other timeZone is invaild HOT 1
- why tag v1.5.5 is not exist HOT 1
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.