/** * Creates a new <code>Weeks</code> by parsing a string in the ISO8601 format 'PnW'. * * <p>The parse will accept the full ISO syntax of PnYnMnWnDTnHnMnS however only the weeks * component may be non-zero. If any other component is non-zero, an exception will be thrown. * * @param periodStr the period string, null returns zero * @return the period in weeks * @throws IllegalArgumentException if the string format is invalid */ @FromString public static Weeks parseWeeks(String periodStr) { if (periodStr == null) { return Weeks.ZERO; } Period p = PARSER.parsePeriod(periodStr); return Weeks.weeks(p.getWeeks()); }