Hello Im planning to store really old dates, but it seems Rails are having trouble with that. Are there any date types I can use that support dates older than for instance 1900?
/MartOn
Hello Im planning to store really old dates, but it seems Rails are having trouble with that. Are there any date types I can use that support dates older than for instance 1900?
/MartOn
DateTime can
Since you said really old dates, why not use Date?
------------------------------------------------------------ Class: Date Class representing a date.
See the documentation to the file date.rb for an overview.
Internally, the date is represented as an Astronomical Julian Day Number, ajd. The Day of Calendar Reform, sg, is also stored, for conversions to other date formats. (There is also an of field for a time zone offset, but this is only for the use of the DateTime subclass.)
A new Date object is created using one of the object creation class methods named after the corresponding date format, and the arguments appropriate to that date format; for instance, Date::civil() (aliased to Date::new()) with year, month, and day-of-month, or Date::ordinal() with year and day-of-year. All of these object creation class methods also take the Day of Calendar Reform as an optional argument.
Date objects are immutable once created.
Once a Date has been created, date values can be retrieved for the different date formats supported using instance methods. For instance, #mon() gives the Civil month, #cwday() gives the Commercial day of the week, and #yday() gives the Ordinal day of the year. Date values can be retrieved in any format, regardless of what format was used to create the Date instance.
The Date class includes the Comparable module, allowing date objects to be compared and sorted, ranges of dates to be created, and so forth.
Yup. that was correct.
I am using hobo in Rails, so the bug is in Hobo, not Rails ![]()
sorry /MartOn