#69 Provide a parser for partials

Joda-Time (26)

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.


  • Daniel Hirscher

    Daniel Hirscher - 2011-04-11

    The forFields() method does not work for me:
    - I do not know which of the fields are missing before parsing, e.g.: "--03-18" or "2011-01--" or "--04--" is possible in my case
    - forFields() does not return a partial, so parsing "--03-18" results in a DateTime with 1970 as year

    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.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks