1
0
mirror of https://github.com/go-task/task.git synced 2025-07-15 01:35:00 +02:00

Export Time Struct to Template

This commit is contained in:
Stephen Prater
2019-08-25 13:16:59 -07:00
parent cb6fe4bb59
commit a1aec8178a
11 changed files with 40 additions and 26 deletions

View File

@ -1,7 +1,6 @@
package status
import (
"fmt"
"os"
"time"
)
@ -47,22 +46,22 @@ func (t *Timestamp) Kind() string {
}
// Value implements the Checker Interface
func (t *Timestamp) Value() (string, error) {
func (t *Timestamp) Value() (interface{}, error) {
sources, err := glob(t.Dir, t.Sources)
if err != nil {
return "<no value>", err
return time.Now(), err
}
sourcesMaxTime, err := getMaxTime(sources...)
if err != nil {
return "<no value>", err
return time.Now(), err
}
if sourcesMaxTime.IsZero() {
return "0", nil
return time.Unix(0, 0), nil
}
return fmt.Sprintf("%d", sourcesMaxTime.Unix()), nil
return sourcesMaxTime, nil
}
func getMinTime(files ...string) (time.Time, error) {