1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-11 10:18:28 +09:00
anytype-heart/util/time/time.go
2024-05-16 13:31:27 +02:00

18 lines
375 B
Go

package time
import (
"time"
"github.com/gogo/protobuf/types"
"github.com/anyproto/anytype-heart/util/pbtypes"
)
func CutValueToDay(val *types.Value) *types.Value {
if val == nil {
return val
}
t := time.Unix(int64(val.GetNumberValue()), 0)
roundTime := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
return pbtypes.Int64(roundTime.Unix())
}