I am using Joda Time library for parsing the string into dateTime using parseDateTime funtion in this library and noticed that date range supported for this library is -292,269,054 to 292,277,023.
Can anyone know on how to limit date range using this library.Especially with year (YYYY) to 9999?
Thanks.
Interval
ClassYou can limit date ranges in Joda-Time with Interval
.
You can then query whether a DateTime
is within that interval/range.
As MadProgrammer commented, limiting a date range is your job as the app developer. Joda-Time cannot know what you consider to be reasonable limits.
To help with that chore of validating data, you might find the Bean Validation spec useful. Defined by JSR 303 (spec 1.0) and JSR 349 (spec 1.1).
With Bean Validation, you can conveniently use annotations to define rules such as a minimum and maximum value for a particular member variable in a class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With