mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: make range picker show actual range with ceiled to date (fix #175)
This commit is contained in:
30
utils/date_test.go
Normal file
30
utils/date_test.go
Normal file
@ -0,0 +1,30 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestDate_Ceil(t *testing.T) {
|
||||
tests := []struct {
|
||||
in string
|
||||
out string
|
||||
}{
|
||||
{
|
||||
"02 Jan 06 15:04 MST",
|
||||
"03 Jan 06 00:00 MST",
|
||||
},
|
||||
{
|
||||
"03 Jan 06 00:00 MST",
|
||||
"03 Jan 06 00:00 MST",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
inDate, _ := time.Parse(time.RFC822, test.in)
|
||||
outDate, _ := time.Parse(time.RFC822, test.out)
|
||||
out := CeilDate(inDate)
|
||||
assert.Equal(t, outDate, out)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user