Bizzare Date, DateTime, date_select issues


#1

I’ve been banging my head against this wall for several hours, and it
hurts now so I’ll stop and ask someone.

In one of my forms I had been using a statement to extract the current
year for use with some form field calculations.

<% currentyear = DateTime.now.year %>

And then further down several date_selects like the following,

<%= date_select "member", "last_medical_date", :id => 

“member_last_medical_date”, :order => [:year, :month, :day], :start_year
=> (currentyear - 5), :end_year => currentyear %>
Date of Last Medical Exam
(YYYY/MM/DD)

The first statement subsequently stopped working! Now with that
statement I get a “ArgumentError” where the DateTime.now.year has raised
an “invalid date” error.

If I use,

<% currentyear = Time.now.year %>

instead, then I can get past THAT error, but then the date_select
statement raises the “invalid date” error message.

Out of desperation I’ve even uninstalled Ruby and Rails, and reinstalled
it all again. This is all latest version stuff… Ruby v1.8.4, Rails
v1.1.2, RadRails v0.6.1, MySQL v5.0.11 all running on Win2kSP4.

Any ideas?
Scott


#2

Ok update;

Ruby isn’t the problem, as I can run an independant script with a
number of different Date/Time operations in order to extract the current
year (including the ones that don’t work in rails).

I’ve set up a whole new Rails environment on one of my Gentoo Linux
servers, moved my project over to that, and pointed it at the existing
MySQL server. That worked fine! So something in the setup of my
environment under Win2k has got buggered (like I said, things were
working, then they stopped!). Uninstalling and re-installing didn’t
help, but having to use two machines for development is just not right.

Any thoughts on how to correct this?

Scott