day.go 444 B

1234567891011121314151617181920212223242526272829
  1. package tfelem
  2. import (
  3. "git.swzry.com/zry/YAGTF/yagtf/utils"
  4. "strconv"
  5. "time"
  6. )
  7. type DayElement struct {
  8. Fill bool
  9. }
  10. func (this *DayElement) ExpectedSize() int {
  11. return 2
  12. }
  13. func (this *DayElement) PrintElement(t time.Time) string {
  14. if this.Fill {
  15. return utils.GetFilledNumberWithTruncate(t.Day(), 2)
  16. } else {
  17. return strconv.Itoa(t.Day())
  18. }
  19. }
  20. func NewDayElement(fill bool) *DayElement {
  21. return &DayElement{
  22. Fill: fill,
  23. }
  24. }