title: Parsing of ISO 8601 time intervals in Javascript
body: <p>I am building a front end component to allow users to choose a date\time range and optionally use time periods as per the ISO 8601 specification.</p>
  
  <p>The component will need to bind to any existing values already set by the user, and so I am looking at how to parse out the time interval period piece for a string such as:</p>
  
  <p>"2007-03-01T13:00Z/P1Y2M10DT2H30M"</p>
  
  <p>I am unsure how to extract the numerical parts of the time interval piece so I can get some sort of object\array, keyed by the letters perhaps so I can easily determine number of years (Y), months (M), etc.</p>
  
  <p>I could have a go at my own regex, but I suspect someone out there has already done this.</p>
  
  <p>I'm wanting to give users a series of number inputs and just set these for any existing period values the user has set previously.</p>
  
  <p>Can anyone suggest any approaches here?</p>
  
  <p>I hope this makes sense!</p>
  
  <p>Thanks</p>