Skip to content

Commit 667aff9

Browse files
committed
feat: save time parsing layout, assign matching layout to c.layout
1 parent 543e5f2 commit 667aff9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

parser.go

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func (c Carbon) Parse(value string, timezone ...string) Carbon {
2727
t, err := time.ParseInLocation(layout, value, c.loc)
2828
if err == nil {
2929
c.time = t
30+
c.layout = layout
3031
return c
3132
}
3233
}
@@ -94,6 +95,7 @@ func (c Carbon) ParseByLayout(value, layout string, timezone ...string) Carbon {
9495
return c
9596
}
9697
c.time = tt
98+
c.layout = layout
9799
return c
98100
}
99101

0 commit comments

Comments
 (0)