From d2fc1af3be51cba23f8c9c7a03ae83792b98657a Mon Sep 17 00:00:00 2001
From: dtapps
Date: Sun, 12 May 2024 19:56:02 +0800
Subject: [PATCH] =?UTF-8?q?-=20=E4=BC=98=E5=8C=96=20`Format`?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 4 ++--
format.go | 23 ++++++++++++++---------
format_test.go | 12 ++++++++++++
version.go | 2 +-
4 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index f93ef4f..43eed08 100644
--- a/README.md
+++ b/README.md
@@ -13,12 +13,12 @@
#### 安装
```shell
-go get -v -u go.dtapp.net/gotime@v1.0.9
+go get -v -u go.dtapp.net/gotime@v1.0.10
```
#### 使用
-```go
+```text
package main
import (
diff --git a/format.go b/format.go
index 5e23304..4155490 100644
--- a/format.go
+++ b/format.go
@@ -1,16 +1,21 @@
package gotime
const (
- DateTimeFormat = "2006-01-02 15:04:05"
- DateTimeShrinkFormat = "2006-01-02 15:04"
- DateFormat = "2006-01-02"
- TimeFormat = "15:04:05"
+ DateTimeFormat = "2006-01-02 15:04:05"
+ DateTimeSFormat = "2006-01-0215:04:05"
+ DateTimeShrinkFormat = "2006-01-02 15:04"
+ DateTimeShrinkSFormat = "2006-01-0215:04"
+ DateFormat = "2006-01-02"
+ TimeFormat = "15:04:05"
+ TimeShrinkFormat = "15:04"
)
const (
- DateTimeZhFormat = "2006年01月02日 15点04分05秒"
- DateTimeZhShrinkFormat = "2006年01月02日 15点04分"
- DateZhFormat = "2006年01月02日"
- TimeZhFormat = "15点04分05秒"
- TimeZhShrinkFormat = "15点04分"
+ DateTimeZhFormat = "2006年01月02日 15点04分05秒"
+ DateTimeZhSFormat = "2006年01月02日15点04分05秒"
+ DateTimeZhShrinkFormat = "2006年01月02日 15点04分"
+ DateTimeZhShrinkSFormat = "2006年01月02日15点04分"
+ DateZhFormat = "2006年01月02日"
+ TimeZhFormat = "15点04分05秒"
+ TimeZhShrinkFormat = "15点04分"
)
diff --git a/format_test.go b/format_test.go
index f6a3818..b819d58 100644
--- a/format_test.go
+++ b/format_test.go
@@ -2,9 +2,21 @@ package gotime
import "testing"
+func TestFormat(t *testing.T) {
+ t.Log("DateTimeFormat", Current().SetFormat(DateTimeFormat))
+ t.Log("DateTimeSFormat", Current().SetFormat(DateTimeSFormat))
+ t.Log("DateTimeShrinkFormat", Current().SetFormat(DateTimeShrinkFormat))
+ t.Log("DateTimeShrinkSFormat", Current().SetFormat(DateTimeShrinkSFormat))
+ t.Log("DateFormat", Current().SetFormat(DateFormat))
+ t.Log("TimeFormat", Current().SetFormat(TimeFormat))
+ t.Log("TimeShrinkFormat", Current().SetFormat(TimeShrinkFormat))
+}
+
func TestZhFormat(t *testing.T) {
t.Log("DateTimeZhFormat", Current().SetFormat(DateTimeZhFormat))
+ t.Log("DateTimeZhSFormat", Current().SetFormat(DateTimeZhSFormat))
t.Log("DateTimeZhShrinkFormat", Current().SetFormat(DateTimeZhShrinkFormat))
+ t.Log("DateTimeZhShrinkSFormat", Current().SetFormat(DateTimeZhShrinkSFormat))
t.Log("DateZhFormat", Current().SetFormat(DateZhFormat))
t.Log("TimeZhFormat", Current().SetFormat(TimeZhFormat))
t.Log("TimeZhShrinkFormat", Current().SetFormat(TimeZhShrinkFormat))
diff --git a/version.go b/version.go
index b2dc21c..2f0dae7 100644
--- a/version.go
+++ b/version.go
@@ -1,3 +1,3 @@
package gotime
-const Version = "1.0.9"
+const Version = "1.0.10"