for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
package timeago
type Config struct {
// Language is an ISO 639 language code like en, ru, de, nl, etc.
// If Language is not set it will default to English "en".
Language string
// Location is the timezone location neeed for parsing
// string date like "2019-01-01 00:00:00" to time.Time.
// If Location is not set it will default to the server's.
// Example: "America/New_York", "Asia/China"
Location string
// Translations is a slice of language sets that can be used to
// overwrite the default translations. Read more about it in the docs
// https://time-ago.github.io/configurations.html#overwrite-translations
Translations []LangSet
}
// NewConfig creates a new Config instance with the given language, location
// and language sets to overwrite the default translations.
func NewConfig(lang, loc string, langSets []LangSet) *Config {
return &Config{
Language: lang,
Location: loc,
Translations: langSets,
// IsLocationProvided check if the location is privided by the user
func (c Config) IsLocationProvided() bool {
return c.Location != ""