Menu

#45 Support ISO 8601 repeating interval

open
nobody
None
5
2014-06-17
2009-02-24
Gary
No

According to http://en.wikipedia.org/wiki/ISO_8601#Repeating_intervals I should be able to say "R/PT10S", as in:

Period period = ISOPeriodFormat.standard().parsePeriod("R1/PT1S");

Today this is not supported:

java.lang.IllegalArgumentException: Invalid format: "R1/PT1S"
at org.joda.time.format.PeriodFormatter.parseMutablePeriod(PeriodFormatter.java:326)
at org.joda.time.format.PeriodFormatter.parsePeriod(PeriodFormatter.java:304)

Discussion

  • Stephen Colebourne

    This is not a bug, but an RFE.

    At present, I think its unlikely to be done as it is a rarely needed requirement.

     
  • Nobody/Anonymous

    Just wanted to cast my vote for this feature - we have a requirement in our app to restrict access to various features during certain intervals, eg. between Dec 10th - Jan 15th every year.

    I was surprised to find that Joda-time doesn't provide a means to define a recurring interval and verify if a given instant occurs within it.

    Btw, I've found many other features of Joda time very useful, thanks!

     
  • Nobody/Anonymous

    I place my comment here to support the message sent on 2009-08-24
    How can you say that a feature you don't provide is rarely needed ??

    Today, in a way to a mondial exchange of sea datas, we need this functionnality... here is only one example.

     
  • Gary Gregory

    Gary Gregory - 2013-01-10

    Hi All:

    How would I say: every night between midnight and 2AM? I could see that because "R" is not supported I'd have to split our "blackout" time in two: "every night at midnight" and "for two hours". Next would be to ask how does one say "every night at midnight"? The "for two hours" part is plain ISO8601.

    Thank you,
    Gary

     
  • Stephen Colebourne

    You can't represent a recurring period in a Period object, so a new class/classes would be needed, which requires a lot of additional infrastructure. Thats why it is currently up to users to handle this.

     

Log in to post a comment.

MongoDB Logo MongoDB