saw
saw copied to clipboard
Absolute time parsing does not work
I noticed this issue when the following command wasn't returning any log events locally:
$ saw get /Production/Gateway/Rails --start "2018-12-10" 130 ↵
I dug into the config/configuration.go
getTime()
func, which looks like its using time.Parse
with the time.RFC3339
format for absolute time values for both start and end timestamps. I plugged similar code into the Go playground, and it looks like this parse format does not support shorthand dates, like were shown in the README example, such as "2018-06-26".
package main
import (
"fmt"
"time"
)
func main() {
timeStr := "2018-06-26"
time, err := time.Parse(time.RFC3339, timeStr)
if(err == nil) {
fmt.Printf("We have the time %s", time.Local())
} else {
fmt.Printf("Error: %s", err);
}
}
Error: parsing time "2018-06-26" as "2006-01-02T15:04:05Z07:00": cannot parse "" as "T"
Just saw that someone else reported a similar issue. Didn't notice it since the issue name wasn't descriptive.
I'm not a Go pro but I can take a crack at fixing this. Are you open to accepting PRs? Perhaps we could support a number of different formats and iterate through them until we find a match? If not, then throw the error.