mirror of
https://github.com/araddon/dateparse.git
synced 2025-01-18 10:53:51 +08:00
Renamed Option to ParserOption to narrow scope and leave room for other features that may have options
This commit is contained in:
parent
e151913243
commit
f8deff45a7
@ -209,7 +209,7 @@ func ParseStrict(datestr string) (time.Time, error) {
|
||||
return p.parse()
|
||||
}
|
||||
|
||||
func parseTime(datestr string, loc *time.Location, opts ...Option) (*parser, error) {
|
||||
func parseTime(datestr string, loc *time.Location, opts ...ParserOption) (*parser, error) {
|
||||
|
||||
p := newParser(datestr, loc, opts...)
|
||||
i := 0
|
||||
@ -1711,17 +1711,17 @@ type parser struct {
|
||||
t *time.Time
|
||||
}
|
||||
|
||||
type Option func(*parser) error
|
||||
type ParserOption func(*parser) error
|
||||
|
||||
// PreferMonthFirst is an option that allows preferMonthFirst to be changed from its default
|
||||
func PreferMonthFirst(preferMonthFirst bool) Option {
|
||||
func PreferMonthFirst(preferMonthFirst bool) ParserOption {
|
||||
return func(p *parser) error {
|
||||
p.preferMonthFirst = preferMonthFirst
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func newParser(dateStr string, loc *time.Location, opts ...Option) *parser {
|
||||
func newParser(dateStr string, loc *time.Location, opts ...ParserOption) *parser {
|
||||
p := &parser{
|
||||
stateDate: dateStart,
|
||||
stateTime: timeIgnore,
|
||||
|
Loading…
Reference in New Issue
Block a user