优化代码

This commit is contained in:
Peleus 2024-01-16 11:08:44 +08:00
parent 15b97e2990
commit 02b43020a6

2
tag.go
View File

@ -114,7 +114,7 @@ func (c Carbon) parseTag() (key, value, tz string) {
if carbon == "" {
return "layout", defaultLayout, tz
}
if len(carbon) <= 7 {
if !strings.HasPrefix(carbon, "layout:") && !strings.HasPrefix(carbon, "format:") {
return "", "", tz
}
key = strings.TrimSpace(carbon[:6])