fix(types):现在日期和时间的指针形式解析不在对空白字符串报错了。
This commit is contained in:
parent
062cc6a9ea
commit
e6d9435c14
|
@ -59,7 +59,7 @@ func ParseDate(t string) (Date, error) {
|
|||
|
||||
func ParseDatep(t string) (*Date, error) {
|
||||
if len(t) == 0 {
|
||||
return nil, fmt.Errorf("不能解析空白的日期时间。")
|
||||
return nil, nil
|
||||
}
|
||||
for _, layout := range dateLayouts {
|
||||
d, err := time.ParseInLocation(layout, t, loc)
|
||||
|
|
|
@ -81,7 +81,7 @@ func ParseDateTime(t string) (DateTime, error) {
|
|||
|
||||
func ParseDateTimep(t string) (*DateTime, error) {
|
||||
if len(t) == 0 {
|
||||
return nil, fmt.Errorf("不能解析空白的日期时间。")
|
||||
return nil, nil
|
||||
}
|
||||
for _, layout := range datetimeLayouts {
|
||||
fmt.Printf("Parse: %s, Try layout: %s\n", t, layout)
|
||||
|
|
Loading…
Reference in New Issue
Block a user