Documentation
¶
Overview ¶
Package timeago provides a simple library to format a time in a "time ago" manner.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultFormat = Format{
ThisSecond: "now",
LastSecond: "1 second ago",
SecondsAgo: "%d seconds ago",
ThisMinute: "now",
LastMinute: "1 minute ago",
MinutesAgo: "%d minutes ago",
ThisHour: "this hour",
LastHour: "last hour",
HoursAgo: "%d hours ago",
Today: "today",
Yesterday: "yesterday",
DaysAgo: "%d days ago",
ThisMonth: "this month",
LastMonth: "last month",
MonthsAgo: "%d months ago",
ThisYear: "this year",
LastYear: "last year",
YearsAgo: "%d years ago",
}
DefaultFormat is the default format of the string returned by the library.
Functions ¶
Types ¶
type Format ¶
type Format struct {
ThisSecond string
LastSecond string
SecondsAgo string
ThisMinute string
LastMinute string
MinutesAgo string
ThisHour string
LastHour string
HoursAgo string
Today string
Yesterday string
DaysAgo string
ThisMonth string
LastMonth string
MonthsAgo string
ThisYear string
LastYear string
YearsAgo string
}
Format is the format of the string returned by the library.
type Precision ¶
type Precision uint
Precision define the minimun amount of time to be considered.
const ( // SecondPrecision is the second precision. SecondPrecision Precision = iota // MinutePrecision is the minute precision. MinutePrecision // HourPrecision is the hour precision. HourPrecision // DayPrecision is the day precision. DayPrecision // MonthPrecision is the month precision. MonthPrecision // YearPrecision is the year precision. YearPrecision )
Click to show internal directories.
Click to hide internal directories.