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{
SecondsFromNow: "%d seconds from now",
NextSecond: "1 second from now",
ThisSecond: "now",
LastSecond: "1 second ago",
SecondsAgo: "%d seconds ago",
MinutesFromNow: "%d minutes from now",
NextMinute: "1 minute from now",
ThisMinute: "now",
LastMinute: "1 minute ago",
MinutesAgo: "%d minutes ago",
HoursFromNow: "%d hours from now",
NextHour: "next hour",
ThisHour: "this hour",
LastHour: "last hour",
HoursAgo: "%d hours ago",
DaysFromNow: "%d days from now",
Tomorrow: "tomorrow",
Today: "today",
Yesterday: "yesterday",
DaysAgo: "%d days ago",
MonthsFromNow: "%d months from now",
NextMonth: "next month",
ThisMonth: "this month",
LastMonth: "last month",
MonthsAgo: "%d months ago",
YearsFromNow: "%d years from now",
NextYear: "next year",
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 {
SecondsFromNow string
NextSecond string
ThisSecond string
SecondsAgo string
LastSecond string
MinutesFromNow string
NextMinute string
ThisMinute string
MinutesAgo string
LastMinute string
HoursFromNow string
NextHour string
ThisHour string
HoursAgo string
LastHour string
DaysFromNow string
Tomorrow string
Today string
Yesterday string
DaysAgo string
MonthsFromNow string
NextMonth string
ThisMonth string
LastMonth string
MonthsAgo string
YearsFromNow string
NextYear 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 minimum 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.