All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
add indonesian language support #47from dimasdanz
add brazilian portuguese language support #46from alexandrepossebom
- Bugfix on
IsSame() and similar functions #40from jftuga - IsSame and similar functions will now work if an object supplied is either a Goment struct or a pointer to a Goment struct.
- Bugfix on
StartOf("isoWeek") not correct on Sunday #38from kesyn
- Added MonthByNumber method to return the month name by number.
- Added MonthShortByNumber method to return the short month name by number.
- Added WeekdayByNumber method to return the weekday name by number. This method is locale aware.
- Updated Weekdays method to be locale aware if bool parameter is provided.
- Updated WeekdaysShort method to be locale aware if bool parameter is provided.
- Updated WeekdaysMin method to be locale aware if bool parameter is provided.
- Support for parsing timestamps with Z timezone - #36
- Implemented Weekday & SetWeekday methods, both are locale aware.
- Implemented Week & SetWeek methods, both are locale aware.
- Implemented WeekYear & SetWeekYear methods, both are locale aware.
- Implemented WeeksInYear method, which is locale aware.
- Implemented ISOWeeksInYear method.
- Implemented SetISOWeek method.
- Implemented SetISOWeekYear method.
- Added ability to pass day name into SetDay method, day name is locale aware.
- Added support for weekday & weekyear tokens in parsing & formatting: e, E, w, ww, W, WW, gg, GG, gggg, GGGG
- Added support for min weekday name token in parsing: dd
- Added support for StartOf("week") && EndOf("week"), both are locale aware.
- Updated SetDay to handle values that are outside of 0-6. Values will be treated as overflow to the current value.
- Updated the constructor that takes a DateTime object to default to the current day's values when not provided for year, month & date. For example, if the constructor is called as
goment.New(DateTime{ Year: 2010 })and today's date is2020-08-08, the created Goment object will be for2010-08-08 00:00:00. - Updated parsing to return an error if the weekday supplied in the parsing string does not match the weekday parsed from date fields.
_, err := New("Wed 08-10-2017", "ddd MM-DD-YYYY") // 8-10-2017 is a Thursday
assert.EqualError(err, "There is a mismatch between parsed weekday and expected weekday")
- Support for locales when parsing Goment datetimes. Locales now can be passed in to the
Newfunction likegoment.New("sábado abr 11 22:52:51 2009", "dddd MMM DD HH:mm:ss YYYY", "es"). Refer to theParsingsection in theREADME.mdfor more information.
- Support for
zzzzformatting token to display timezone name, e.g.Central Standard Time.
- Support for internationalization using locales when displaying Goment datetimes. Locales are currently only supported for the
Format,From,To,FromNow,ToNow&Calendarmethods. - Initial supported locales are
en,esandfr. There is a framework setup to add new languages by adding a new file in the/localesfolder. Refer to thei18nsection in theREADME.mdfor more information. - Added
Weekdays,WeekdaysShort,WeekdaysMin,Months&MonthsShortmethods for getting locale-specific values. - Support for
YYYYY,YYYYYY&xdatetime formats.
Formatnow uses functions to replace values in layout, instead of converting to a Go datetime layout and using the Time.Format method.
- Removed internal submodules.
- This is the first tagged release of Goment. It has support for Go modules using
go mod.