Ruby's Time#yday should start from 1; close #581

parent 26600ca4
......@@ -395,7 +395,7 @@ mrb_time_yday(mrb_state *mrb, mrb_value self)
tm = (struct mrb_time *)mrb_check_datatype(mrb, self, &mrb_time_type);
if (!tm) return mrb_nil_value();
return mrb_fixnum_value(tm->datetime.tm_yday);
return mrb_fixnum_value(tm->datetime.tm_yday + 1);
}
/* 15.2.19.7.32 */
......
......@@ -177,7 +177,7 @@ if Object.const_defined?(:Time)
end
assert('Time#yday', '15.2.19.7.31') do
Time.gm(2012, 12, 23).yday == 357
Time.gm(2012, 12, 23).yday == 358
end
assert('Time#year', '15.2.19.7.32') do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment