Comments (1)
Hello,
In your example, AddDate(0, 1, 0)
returns 05-01-2021.
This is the expected behavior. From Time.AddDate:
AddDate normalizes its result in the same way that Date does, so, for example, adding one month to October 31 yields December 1, the normalized form for November 31.
You can fix it by adding a month after finding the first day of the month.
playground
from now.
Related Issues (20)
- License
- Make FirstDayMonday a variable on now.Now struct or a parameter to BeginningOfWeek HOT 1
- Unable to parse time without day HOT 1
- Milliseconds are not parsed correctly
- Alternative API?
- Broken when clocks go back HOT 2
- WeekStartDay as an attribute of Now type HOT 2
- 可以考虑内置支持下这些格式吗?
- Cant find variable now HOT 1
- Parse day of the week
- please add mysql datetime layout HOT 1
- Current quarter HOT 1
- don't allocate config inside With() HOT 1
- Make easier to test with time.Now as a config HOT 2
- Serious error with format "2006-01-02T15:04:05Z" (also see #22) HOT 1
- How about add a maxTime and a minTime const
- How do get the previous month's time? HOT 1
- Recommend a better golang package for datetime
- Rename License to LICENSE 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 now.