time_test.go 947 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package mhayaTime
  2. import (
  3. "testing"
  4. )
  5. func TestMhayaTime_Now(t *testing.T) {
  6. now := Now()
  7. AddOffsetTime(-60)
  8. now1 := Now()
  9. t.Logf("now = %s, now-offset = %s\n", now.ToDateTimeFormat(), now1.ToDateTimeFormat())
  10. }
  11. func TestMhayaTime_Yesterday(t *testing.T) {
  12. yesterday := Yesterday()
  13. t.Log(yesterday.ToDateTimeFormat())
  14. }
  15. func TestMhayaTime_Tomorrow(t *testing.T) {
  16. yesterday := Tomorrow()
  17. t.Log(yesterday.ToDateTimeFormat())
  18. }
  19. func TestMhayaTime_CreateFromTimestamp(t *testing.T) {
  20. ct := CreateFromTimestamp(1614150502000)
  21. t.Log(ct.ToDateTimeFormat())
  22. }
  23. func TestMhayaTime_CreateFromDateTime(t *testing.T) {
  24. ct := CreateFromDateTime(2012, 12, 24, 23, 59, 59)
  25. t.Log(ct.ToDateTimeFormat())
  26. }
  27. func TestMhayaTime_CreateFromDate(t *testing.T) {
  28. ct := CreateFromDate(2012, 12, 24)
  29. t.Log(ct.ToDateTimeFormat())
  30. }
  31. func TestMhayaTime_CreateFromTime(t *testing.T) {
  32. ct := CreateFromTime(23, 59, 59)
  33. t.Log(ct.ToDateTimeFormat())
  34. }