Writing a ReadablePartial, e.g. Month and Day but without Year results in: --03-18
Parsing this String with: ISODateTimeFormat.date().parseDateTime("--03-18");
fails with "Invalid Format".
Ok, the formatter is supposed to construct a DateTime object which is a Instant, not a Partial.
However it would be great to parse into a Partial.
Alternatively, how would I serialize and deserialize a partial into a string?
Thank you for the great library.
The method ISODateTimeFormat.forFields() handles partial formats. As you say, parsing them back isn't easy, but it isn't easy to fix either.
http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#forFields%28java.util.Collection,%20boolean,%20boolean%29
The forFields() method does not work for me:
I think I will write my own formatter and parser.
The use case is to handle partial birthday dates. For some people I do not know the year, for others not the exact day of the month. So partials are a good choice for me, since birthdays do not need a time zone either.
i'm not sure how to upvote issues on sourceforge, but count this as my vote!
i have a compelling use case for parsing Partials from Strings and would love to see this implemented in Joda-time. for now, i'll try to roll my own. thanks for maintaining this great library!
http://stackoverflow.com/questions/9611002/
http://stackoverflow.com/questions/5068626/