I got a custom class that contains JodaTime’s LocalDate variable to hold a date.
My swing application has a JSpinner with Date model.
I made a button click event so that the date gets stored inside an object’s LocalDate data member.
Problem is compiler gives me the IllegalArgumentException.
I tried to use LocalDate.parse(spinnerDate.getVAlue().toString()) but is not working.
Also tried to switch to using DateTime type but same result was given.
Given that an
IllegalArgumentExceptionis something that would be generated at runtime, I doubt you’re getting a ‘compiler’ error.If you don’t care what the timezone or chronology is (probable), you could always use
new LocalDate(spinnerDate.getValue());.Otherwise, consider implementing your own spinner that can store
LocalDates natively, or switching to using a pre-defined list ofLocalDates in aSpinnerListModel.