An "OR" concept would be a good addition in Java 9, but doesn't exist
now. At present, you'd have to try lots of combinations, or pre-parse
using a regex or similar,
Stephen

On 29 July 2015 at 08:28, costin <costin.leau+j...@gmail.com> wrote:
> Thanks for the quick reply Stephen.
>
> The main advantage that we found with Joda (thanks for working on it,
> it's a brilliant piece of software), is that is quite lenient in
> parsing the input while maintaining correctness; in particular it
> allows (just like ISO 8601 indicates) for certain "tokens" inside the
> date to be skipped.
>
> Based on the Javadocs it looks like the complete grammar for
> dateOptionalTime would be:
>
>      * date-opt-time     = date-element ['T' [time-element] [offset]]
>      * date-element      = std-date-element | ord-date-element |
> week-date-element
>      * std-date-element  = yyyy ['-' MM ['-' dd]]
>      * ord-date-element  = yyyy ['-' DDD]
>      * week-date-element = xxxx '-W' ww ['-' e]
>      * time-element      = HH [minute-element] | [fraction]
>      * minute-element    = ':' mm [second-element] | [fraction]
>      * second-element    = ':' ss [fraction]
>      * fraction          = ('.' | ',') digit+
>
> so based on using optional blocks, the syntax would be roughly (skipping
> fraction):
>
> "yyyy-[MM[dd]][DDD][W'ww['-'e]]['T'[HH[':'mm[':'ss]]][Z]]"
>
> However as you mentioned since there's no proper OR in java.time one
> can pass in an invalid date; is there any solution for that?
>
> Outside creating a formatter for each combination/permutation
> (cartesian product) and trying to apply each one until it matches.
>
> Cheers,
>
>
>
> --
> View this message in context: 
> http://joda-interest.219941.n2.nabble.com/coverting-Joda-dateOptionalTimeParser-to-java-time-tp7572605p7572607.html
> Sent from the Joda-Interest mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Joda-interest mailing list
> Joda-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/joda-interest

------------------------------------------------------------------------------
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to