Documentation ¶
Index ¶
- func IsGoment(obj interface{}) bool
- func IsTime(obj interface{}) bool
- type DateTime
- type Diff
- type Goment
- func (g *Goment) Add(args ...interface{}) *Goment
- func (g *Goment) Calendar(args ...interface{}) string
- func (g *Goment) Clone() *Goment
- func (g *Goment) Date() int
- func (g *Goment) Day() int
- func (g *Goment) DayOfYear() int
- func (g *Goment) DaysInMonth() int
- func (g *Goment) Diff(args ...interface{}) int
- func (g *Goment) EndOf(units string) *Goment
- func (g *Goment) Format(args ...interface{}) string
- func (g *Goment) From(args ...interface{}) string
- func (g *Goment) FromNow(args ...interface{}) string
- func (g *Goment) Get(units string) int
- func (g *Goment) Hour() int
- func (g *Goment) ISOWeek() int
- func (g *Goment) ISOWeekYear() int
- func (g *Goment) ISOWeekday() int
- func (g *Goment) ISOWeeksInYear() int
- func (g *Goment) IsAfter(args ...interface{}) bool
- func (g *Goment) IsBefore(args ...interface{}) bool
- func (g *Goment) IsBetween(args ...interface{}) bool
- func (g *Goment) IsDST() bool
- func (g *Goment) IsLeapYear() bool
- func (g *Goment) IsSame(args ...interface{}) bool
- func (g *Goment) IsSameOrAfter(args ...interface{}) bool
- func (g *Goment) IsSameOrBefore(args ...interface{}) bool
- func (g *Goment) Local() *Goment
- func (g *Goment) Millisecond() int
- func (g *Goment) Minute() int
- func (g *Goment) Month() int
- func (g *Goment) Nanosecond() int
- func (g *Goment) Quarter() int
- func (g *Goment) Second() int
- func (g *Goment) Set(units string, value int) *Goment
- func (g *Goment) SetDate(date int) *Goment
- func (g *Goment) SetDay(day int) *Goment
- func (g *Goment) SetDayOfYear(doy int) *Goment
- func (g *Goment) SetHour(hours int) *Goment
- func (g *Goment) SetISOWeek(week int) *Goment
- func (g *Goment) SetISOWeekYear(weekYear int) *Goment
- func (g *Goment) SetISOWeekday(weekday int) *Goment
- func (g *Goment) SetMillisecond(milliseconds int) *Goment
- func (g *Goment) SetMinute(minutes int) *Goment
- func (g *Goment) SetMonth(month int) *Goment
- func (g *Goment) SetNanosecond(nanoseconds int) *Goment
- func (g *Goment) SetQuarter(quarter int) *Goment
- func (g *Goment) SetSecond(seconds int) *Goment
- func (g *Goment) SetUTCOffset(offset int) *Goment
- func (g *Goment) SetWeek(week int) *Goment
- func (g *Goment) SetWeekYear(weekYear int) *Goment
- func (g *Goment) SetWeekday(weekday int) *Goment
- func (g *Goment) SetYear(year int) *Goment
- func (g *Goment) StartOf(units string) *Goment
- func (g *Goment) Subtract(args ...interface{}) *Goment
- func (g *Goment) To(args ...interface{}) string
- func (g *Goment) ToArray() []int
- func (g *Goment) ToDateTime() DateTime
- func (g *Goment) ToISOString() string
- func (g *Goment) ToNow(args ...interface{}) string
- func (g *Goment) ToString() string
- func (g *Goment) ToTime() time.Time
- func (g *Goment) ToUnix() int64
- func (g *Goment) UTC() *Goment
- func (g *Goment) UTCOffset() int
- func (g *Goment) Week() int
- func (g *Goment) WeekYear() int
- func (g *Goment) Weekday() int
- func (g *Goment) WeeksInYear() int
- func (g *Goment) Year() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DateTime ¶
type DateTime struct { Year int Month int Day int Hour int Minute int Second int Nanosecond int Location *time.Location }
DateTime is a class to define a date & time.
type Diff ¶
Diff holds a start and end Goment.
type Goment ¶
type Goment struct {
// contains filtered or unexported fields
}
Goment is the main class.
func Unix ¶
Unix creates an instance of the Goment library from the Unix timestamp (seconds since the Unix Epoch).
func (*Goment) Calendar ¶
Calendar displays time relative to a given referenceTime (defaults to now).
func (*Goment) DaysInMonth ¶
DaysInMonth returns the number of days in the set month.
func (*Goment) EndOf ¶
EndOf mutates the original Goment by setting it to the end of a unit of time.
func (*Goment) Format ¶
Format takes a string of tokens and replaces them with their corresponding values to display the Goment.
func (*Goment) Get ¶
Get is a string getter using the supplied units. Returns 0 if unsupported property.
func (*Goment) ISOWeekday ¶
ISOWeekday gets the ISO day of the week with 1 being Monday and 7 being Sunday.
func (*Goment) ISOWeeksInYear ¶
ISOWeeksInYear gets the number of weeks in the current Goment's year, according to ISO weeks.
func (*Goment) IsLeapYear ¶
IsLeapYear returns true if that year is a leap year, and false if it is not.
func (*Goment) IsSameOrAfter ¶
IsSameOrAfter will check if a Goment is after or the same as another Goment.
func (*Goment) IsSameOrBefore ¶
IsSameOrBefore will check if a Goment is before or the same as another Goment.
func (*Goment) Set ¶
Set is a generic setter, accepting units as the first argument, and value as the second.
func (*Goment) SetDate ¶
SetDate sets the day of the month. If the date passed in is greater than the number of days in the month, then the day is set to the last day of the month.
func (*Goment) SetDayOfYear ¶
SetDayOfYear sets the day of the year. For non-leap years, 366 is treated as 365.
func (*Goment) SetISOWeek ¶
SetISOWeek sets the ISO week of the year.
func (*Goment) SetISOWeekYear ¶
SetISOWeekYear sets the ISO week-year.
func (*Goment) SetISOWeekday ¶
SetISOWeekday sets the ISO day of the week with 1 being Monday and 7 being Sunday.
func (*Goment) SetMillisecond ¶
SetMillisecond sets the milliseconds.
func (*Goment) SetMonth ¶
SetMonth sets the month (January = 1...). If new month has less days than current month, the date is pinned to the end of the target month.
func (*Goment) SetNanosecond ¶
SetNanosecond sets the nanoseconds.
func (*Goment) SetQuarter ¶
SetQuarter sets the quarter (1 to 4).
func (*Goment) SetUTCOffset ¶
SetUTCOffset sets the UTC offset in minutes. If the offset is less than 16 and greater than -16, the value is treated as hours.
func (*Goment) SetWeekYear ¶
SetWeekYear sets the week-year according to the locale.
func (*Goment) SetWeekday ¶
SetWeekday sets the day of the week according to the locale.
func (*Goment) StartOf ¶
StartOf mutates the original Goment by setting it to the start of a unit of time.
func (*Goment) ToDateTime ¶
ToDateTime returns a DateTime struct.
func (*Goment) ToISOString ¶
ToISOString returns a ISO8601 standard representation of the Goment time.
func (*Goment) ToUnix ¶
ToUnix returns the Unix timestamp (the number of seconds since the Unix Epoch).
func (*Goment) WeeksInYear ¶
WeeksInYear gets the number of weeks according to locale in the current Goment's year.