You've already forked pocketbase
mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-11-30 09:09:00 +02:00
added yesterday and tomorrow date filter macros
This commit is contained in:
@@ -23,6 +23,26 @@ var identifierMacros = map[string]func() (any, error){
|
||||
|
||||
return d.String(), nil
|
||||
},
|
||||
"@yesterday": func() (any, error) {
|
||||
yesterday := timeNow().UTC().AddDate(0, 0, -1)
|
||||
|
||||
d, err := types.ParseDateTime(yesterday)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("@yesterday: %w", err)
|
||||
}
|
||||
|
||||
return d.String(), nil
|
||||
},
|
||||
"@tomorrow": func() (any, error) {
|
||||
tomorrow := timeNow().UTC().AddDate(0, 0, 1)
|
||||
|
||||
d, err := types.ParseDateTime(tomorrow)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("@tomorrow: %w", err)
|
||||
}
|
||||
|
||||
return d.String(), nil
|
||||
},
|
||||
"@second": func() (any, error) {
|
||||
return timeNow().UTC().Second(), nil
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user