Skip to content

Commit 69cffc1

Browse files
committed
♻️ refactor: update codebase #2
1 parent e90a20f commit 69cffc1

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

const.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,14 @@ const (
319319
)
320320

321321
var (
322-
// ApplyTimeRegexp is a regular expression that matches various time formats such as:
322+
// TimeFormatRegexp is a regular expression that matches various time formats such as:
323323
// 15:04:05, 15:04:05.000, 15:04:05.000000, 15, 2017-01-01 15:04, 2021-07-20T00:59:10Z,
324324
// 2021-07-20T00:59:10+08:00, 2021-07-20T00:00:10-07:00, etc.
325-
ApplyTimeRegexp = regexp.MustCompile(`(\s+|^\s*|T)\d{1,2}((:\d{1,2})*|((:\d{1,2}){2}\.(\d{3}|\d{6}|\d{9})))(\s*$|[Z+-])`)
325+
TimeFormatRegexp = regexp.MustCompile(`(\s+|^\s*|T)\d{1,2}((:\d{1,2})*|((:\d{1,2}){2}\.(\d{3}|\d{6}|\d{9})))(\s*$|[Z+-])`)
326326

327-
// OnlyTimeRegexp is a regular expression that matches time formats such as:
327+
// TimeOnlyRegexp is a regular expression that matches time formats such as:
328328
// 15:04:05, 15, 15:04:05.000, 15:04:05.000000, etc.
329-
OnlyTimeRegexp = regexp.MustCompile(`^\s*\d{1,2}((:\d{1,2})*|((:\d{1,2}){2}\.(\d{3}|\d{6}|\d{9})))\s*$`)
329+
TimeOnlyRegexp = regexp.MustCompile(`^\s*\d{1,2}((:\d{1,2})*|((:\d{1,2}){2}\.(\d{3}|\d{6}|\d{9})))\s*$`)
330330
)
331331

332332
var (

time.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,8 @@ func (t *Timex) Parse(s ...string) (value time.Time, err error) {
623623
)
624624

625625
for _, str := range s {
626-
hasTimeInStr := ApplyTimeRegexp.MatchString(str) // match 15:04:05, 15
627-
onlyTimeInStr = hasTimeInStr && onlyTimeInStr && OnlyTimeRegexp.MatchString(str)
626+
hasTimeInStr := TimeFormatRegexp.MatchString(str) // match 15:04:05, 15
627+
onlyTimeInStr = hasTimeInStr && onlyTimeInStr && TimeOnlyRegexp.MatchString(str)
628628
if value, err = t.parseWithFormat(str, currentLocation); err == nil {
629629
location := value.Location()
630630
parseTime = FormatTimex(value)

0 commit comments

Comments
 (0)