summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/standard/parsedate.y10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/standard/parsedate.y b/ext/standard/parsedate.y
index 84ee81356c..7112b611b7 100644
--- a/ext/standard/parsedate.y
+++ b/ext/standard/parsedate.y
@@ -862,6 +862,16 @@ yylex ()
yyInput--;
if (sign < 0)
yylval.Number = -yylval.Number;
+ /* Ignore ordinal suffixes on numbers */
+ c = *yyInput;
+ if (c == 's' || c == 'n' || c == 'r' || c == 't') {
+ c = *++yyInput;
+ if (c == 't' || c == 'd' || c == 'h') {
+ yyInput++;
+ } else {
+ yyInput--;
+ }
+ }
return sign ? tSNUMBER : tUNUMBER;
}
if (ISALPHA (c))