Change the default TZ to the local TZ (#20)
diff --git a/commands/interceptor/duration.go b/commands/interceptor/duration.go
index f17c2d9..186c3fe 100644
--- a/commands/interceptor/duration.go
+++ b/commands/interceptor/duration.go
@@ -69,7 +69,7 @@
func ParseDuration(start, end string) (startTime, endTime time.Time, step schema.Step) {
logger.Log.Debugln("Start time:", start, "end time:", end)
- now := time.Now().UTC()
+ now := time.Now()
// both are absent
if start == "" && end == "" {
diff --git a/commands/interceptor/duration_test.go b/commands/interceptor/duration_test.go
index 64064d1..e8720ae 100644
--- a/commands/interceptor/duration_test.go
+++ b/commands/interceptor/duration_test.go
@@ -26,8 +26,7 @@
)
func TestParseDuration(t *testing.T) {
- now := time.Now().UTC()
-
+ now := time.Now()
type args struct {
start string
end string
@@ -84,14 +83,16 @@
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotStartTime, gotEndTime, gotStep := ParseDuration(tt.args.start, tt.args.end)
- if !reflect.DeepEqual(gotStartTime.Truncate(time.Minute), tt.wantedStartTime.Truncate(time.Minute)) {
+ current := gotStartTime.Truncate(time.Minute).Format(timeFormat)
+ spec := tt.wantedStartTime.Truncate(time.Minute).Format(timeFormat)
+ if !reflect.DeepEqual(current, spec) {
t.Errorf(
"ParseDuration() got start time = %v, wanted start time %v",
gotStartTime.Truncate(time.Minute),
tt.wantedStartTime.Truncate(time.Minute),
)
}
- if !reflect.DeepEqual(gotEndTime.Truncate(time.Minute), tt.wantedEndTime.Truncate(time.Minute)) {
+ if !reflect.DeepEqual(current, spec) {
t.Errorf(
"ParseDuration() got end time = %v, wanted end time %v",
gotEndTime.Truncate(time.Minute),