Question

Working with dates in ruby and rails on windows, I'm having problems with pre-epoch dates (before 1970) throwing out of range exceptions. I tried using both Time and DateTime objects, but still have the same problems.

Was it helpful?

Solution

If you only need dates (no times), the Date class in ruby should handle dates before 1970. But it has only a resolution of days. I don't know if there are solutions, if you also need times before 1970 (source)

OTHER TIPS

You can also check out the section on dates on ruby-doc.org. I'm still learning Ruby but it sounds like you could use either the Civil or Commerical Date to go back before 1970.

Ended up using the Date class, problem then became making that work with the rails select helper - which didn't happen, just generated the html myself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top