serialize dates properly