mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/date/date_core.c (c_valid_{julian,gregorian}_p): fixed the range of month.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
838af29cb1
commit
3fbc9440fe
2 changed files with 11 additions and 8 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Jun 24 00:44:15 2011 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* ext/date/date_core.c (c_valid_{julian,gregorian}_p): fixed the range of month.
|
||||
|
||||
Fri Jun 24 00:14:23 2011 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* ext/date/date_core.c: trivial changes on text.
|
||||
|
|
|
@ -693,7 +693,7 @@ c_valid_julian_p(int y, int m, int d, int *rm, int *rd)
|
|||
|
||||
if (m < 0)
|
||||
m += 13;
|
||||
if (m < 0 || m > 12)
|
||||
if (m < 1 || m > 12)
|
||||
return 0;
|
||||
last = c_julian_last_day_of_month(y, m);
|
||||
if (d < 0)
|
||||
|
@ -712,7 +712,7 @@ c_valid_gregorian_p(int y, int m, int d, int *rm, int *rd)
|
|||
|
||||
if (m < 0)
|
||||
m += 13;
|
||||
if (m < 0 || m > 12)
|
||||
if (m < 1 || m > 12)
|
||||
return 0;
|
||||
last = c_gregorian_last_day_of_month(y, m);
|
||||
if (d < 0)
|
||||
|
@ -2114,17 +2114,16 @@ valid_civil_p(VALUE y, int m, int d, double sg,
|
|||
decode_year(y, ns ? -1 : +1, &nth2, ry);
|
||||
}
|
||||
}
|
||||
else if (style > 1) {
|
||||
else {
|
||||
decode_year(y, style, nth, ry);
|
||||
r = c_valid_julian_p(*ry, m, d, rm, rd);
|
||||
if (style < 0)
|
||||
r = c_valid_gregorian_p(*ry, m, d, rm, rd);
|
||||
else
|
||||
r = c_valid_julian_p(*ry, m, d, rm, rd);
|
||||
if (!r)
|
||||
return 0;
|
||||
c_civil_to_jd(*ry, *rm, *rd, style, rjd, ns);
|
||||
}
|
||||
else {
|
||||
decode_year(y, style, nth, ry);
|
||||
r = c_valid_civil_p(*ry, m, d, style, rm, rd, rjd, ns);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue