@@ -152,18 +152,17 @@ func (now *Now) Parse(strs ...string) (t time.Time, err error) {
152
152
var (
153
153
setCurrentTime bool
154
154
parseTime []int
155
- currentTime = []int {now .Nanosecond (), now .Second (), now .Minute (), now .Hour (), now .Day (), int (now .Month ()), now .Year ()}
156
155
currentLocation = now .Location ()
157
156
onlyTimeInStr = true
157
+ currentTime = formatTimeToList (now .Time )
158
158
)
159
159
160
160
for _ , str := range strs {
161
161
hasTimeInStr := hasTimeRegexp .MatchString (str ) // match 15:04:05, 15
162
162
onlyTimeInStr = hasTimeInStr && onlyTimeInStr && onlyTimeRegexp .MatchString (str )
163
163
if t , err = now .parseWithFormat (str , currentLocation ); err == nil {
164
164
location := t .Location ()
165
-
166
- parseTime = []int {t .Nanosecond (), t .Second (), t .Minute (), t .Hour (), t .Day (), int (t .Month ()), t .Year ()}
165
+ parseTime = formatTimeToList (t )
167
166
168
167
for i , v := range parseTime {
169
168
// Don't reset hour, minute, second if current time str including time
@@ -190,7 +189,7 @@ func (now *Now) Parse(strs ...string) (t time.Time, err error) {
190
189
}
191
190
192
191
t = time .Date (parseTime [6 ], time .Month (parseTime [5 ]), parseTime [4 ], parseTime [3 ], parseTime [2 ], parseTime [1 ], parseTime [0 ], location )
193
- currentTime = [] int { t . Nanosecond (), t . Second (), t . Minute (), t . Hour (), t . Day (), int ( t . Month ()), t . Year ()}
192
+ currentTime = formatTimeToList ( t )
194
193
}
195
194
}
196
195
return
0 commit comments