New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in time logic: Year is out of valid range: 1400..10000. #5755
Comments
I think it's a good idea to forbid storing such times. Marking as a ReQL_proposal for discussion for one of the upcoming releases. Fixing the limitation is likely harder and I doubt a lot of people will be using ReQL date functions for dates before 1400. |
Note that the limitation is problematic in .NET since it's idiomatic to use |
Hi @alf, perhaps using a nullable In my humble opinion, it would be equally (if not more) idiomatic in .NET to use a nullable type rather than |
Personally I prefer: if (lastChecked.AddHours(1) > DateTime.UtcNow) {
// do some work
} as opposed to: if (lastChecked.HasValue && lastChecked.Value.AddHours(1) > DateTime.UtcNow) {
// do some work
} While optional values have a place, in this case a reasonable default value is a better choice. |
Hi @alf. May I humbly suggest (or you might already know), using the null conditional operator
The only difference is the If I still could offer any advice, guidance, or best practice on this particular subject w.r.t C#/.NET RethinkDB driver it would still be to use nullable types. This is how I ultimately work with issues like this in my applications. |
No need to be humble. I'd forgotten about that bit of syntax and I agree that this solves the issue. |
Glad to hear that there's a decent work-around. Given that storing such dates with years before 1400 might still be common in C#, completely disallowing those dates from getting stored is probably a bad idea. I think we should just improve the error message then. |
On May 9, Daniel Mewes wrote "Fixing the limitation is likely harder and I doubt a lot of people will be using ReQL date functions for dates before 1400". That may be true, but when you're working with genealogical data (like I am), even earlier dates are (should be) possible. Other NoSQL databases do not have this restriction, as far as I can tell. |
It seems that things start breaking if you're handling dates before the year 1400.
The easiest way to provoke this error message is:
It seems this limitation is documented, however the error message does not point to this and google isn't very helpful since the error message seems to be a generic error from a library.
Since it is possible to insert data that contains pre-medieval dates like below, confusion ensues.
I stumbled upon this since the .NET RethinkDb.Driver seems to serialize dates differently in different situations. Thus when I insert a new row it uses epochTime, but when I compare the date in a row with a datetime it uses iso8601.
I suggest the following improvements:
The text was updated successfully, but these errors were encountered: