mirror of
https://github.com/araddon/dateparse.git
synced 2025-08-20 12:18:42 +08:00
Changes to the algorithm to handle when preferMonthFirst is false
Credit for this to KamalGalrani
This commit is contained in:
12
parseany.go
12
parseany.go
@@ -269,8 +269,14 @@ iterRunes:
|
||||
p.setMonth()
|
||||
p.dayi = i + 1
|
||||
}
|
||||
} else {
|
||||
if p.daylen == 0 {
|
||||
p.daylen = i
|
||||
p.setDay()
|
||||
p.moi = i + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case '.':
|
||||
// 3.31.2014
|
||||
@@ -446,8 +452,14 @@ iterRunes:
|
||||
p.setDay()
|
||||
p.yeari = i + 1
|
||||
}
|
||||
} else {
|
||||
if p.molen == 0 {
|
||||
p.molen = i - p.moi
|
||||
p.setMonth()
|
||||
p.yeari = i + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case dateDigitWs:
|
||||
// 18 January 2018
|
||||
|
Reference in New Issue
Block a user