feat: add NowDateOrTime

This commit is contained in:
dudaodong committed 2023-07-26 15:03:59 +08:00
1 parent 31e8b12674
commit 326e7881a6
4 files changed
+110

No files matched your search

+19
View File
@@ -375,3 +375,22 @@ func TestIsWeekend(t *testing.T) {
result2 := IsWeekend(date2)
assert.Equal(false, result2)
}
func TestNowDateOrTime(t *testing.T) {
t.Parallel()
formats := []string{
"yyyy-mm-dd hh:mm:ss",
"yyyy-mm-dd",
"dd-mm-yy hh:mm:ss",
"yyyy/mm/dd hh:mm:ss",
"hh:mm:ss",
"yyyy/mm",
"yyyy-mm-dd hh",
}
for i := 0; i < len(formats); i++ {
result := NowDateOrTime(formats[i], "UTC")
t.Log(result)
}
}