File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1551,6 +1551,28 @@ iterRunes:
15511551 // 13-Feb-03 ambiguous
15521552 // 28-Feb-03 ambiguous
15531553 // 29-Jun-2016
1554+ length := len (datestr ) - (p .moi + p .molen + 1 )
1555+ if length == 4 {
1556+ p .yearlen = 4
1557+ p .set (p .yeari , "2006" )
1558+ // We now also know that part1 was the day
1559+ p .dayi = 0
1560+ p .daylen = p .part1Len
1561+ p .setDay ()
1562+ } else if length == 2 {
1563+ // We have no idea if this is
1564+ // yy-mon-dd OR dd-mon-yy
1565+ //
1566+ // We are going to ASSUME (bad, bad) that it is dd-mon-yy which is a horible assumption
1567+ p .ambiguousMD = true
1568+ p .yearlen = 2
1569+ p .set (p .yeari , "06" )
1570+ // We now also know that part1 was the day
1571+ p .dayi = 0
1572+ p .daylen = p .part1Len
1573+ p .setDay ()
1574+ }
1575+
15541576 return p , nil
15551577
15561578 case dateDigitDot :
Original file line number Diff line number Diff line change @@ -213,6 +213,10 @@ var testInputs = []dateTest{
213213 {in : "2014-04-02" , out : "2014-04-02 00:00:00 +0000 UTC" },
214214 {in : "2014-03-31" , out : "2014-03-31 00:00:00 +0000 UTC" },
215215 {in : "2014-4-2" , out : "2014-04-02 00:00:00 +0000 UTC" },
216+ // dd-mmm-yy
217+ {in : "28-Feb-02" , out : "2002-02-28 00:00:00 +0000 UTC" },
218+ {in : "15-Jan-18" , out : "2018-01-15 00:00:00 +0000 UTC" },
219+ {in : "15-Jan-2017" , out : "2017-01-15 00:00:00 +0000 UTC" },
216220 // yyyy-mm
217221 {in : "2014-04" , out : "2014-04-01 00:00:00 +0000 UTC" },
218222 // yyyy-mm-dd hh:mm:ss AM
You can’t perform that action at this time.
0 commit comments