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