1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Expose next_check_at in the web ui and API

This commit is contained in:
Frédéric Guillot 2023-10-17 17:56:17 -07:00
parent 5dc44453ba
commit 23d2cfe0f9
22 changed files with 48 additions and 1 deletions

View file

@ -107,7 +107,8 @@ func (f *funcMap) Map() template.FuncMap {
"nonce": func() string {
return crypto.GenerateRandomStringHex(16)
},
"deRef": func(i *int) int { return *i },
"deRef": func(i *int) int { return *i },
"duration": duration,
// These functions are overrode at runtime after the parsing.
"elapsed": func(timezone string, t time.Time) string {
@ -160,6 +161,21 @@ func isEmail(str string) bool {
return err == nil
}
// Returns the duration in human readable format (hours and minutes).
func duration(t time.Time) string {
if t.IsZero() {
return ""
}
diff := time.Until(t)
if diff < 0 {
return ""
}
return diff.String()
}
func elapsedTime(printer *locale.Printer, tz string, t time.Time) string {
if t.IsZero() {
return printer.Printf("time_elapsed.not_yet")