mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 16:55:15 +00:00
add last 30 days to loose date support
This commit is contained in:
parent
570ccabe46
commit
f2109afa0e
|
@ -256,6 +256,10 @@ func ParseLooseFormatTime(s string) (LooseFormatTime, error) {
|
||||||
t = time.Now().AddDate(0, -1, 0)
|
t = time.Now().AddDate(0, -1, 0)
|
||||||
return LooseFormatTime(t), nil
|
return LooseFormatTime(t), nil
|
||||||
|
|
||||||
|
case "last 30 days":
|
||||||
|
t = time.Now().AddDate(0, 0, -30)
|
||||||
|
return LooseFormatTime(t), nil
|
||||||
|
|
||||||
case "last year":
|
case "last year":
|
||||||
t = time.Now().AddDate(-1, 0, 0)
|
t = time.Now().AddDate(-1, 0, 0)
|
||||||
return LooseFormatTime(t), nil
|
return LooseFormatTime(t), nil
|
||||||
|
@ -357,4 +361,3 @@ func BeginningOfTheDay(t time.Time) time.Time {
|
||||||
func Over24Hours(since time.Time) bool {
|
func Over24Hours(since time.Time) bool {
|
||||||
return time.Since(since) >= 24*time.Hour
|
return time.Since(since) >= 24*time.Hour
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user