I am dealing with reoccurrences and using the google-rfc-2445 library
I have tried many different things at this point and it seems as though my DateTime variable is malformed and I am not sure what is happening.
The output looks like this 2015-05-05T17:11:11.000-05:00
In the database it looks like this 2015-05-05 22:11:11.0
The error I am getting looks like this
java.text.ParseException: cannot parse [[DTSTART=20150505T221111Z]] in [RRULE, recur]
I have tried formatting the output with no luck.
Date d = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
try{
d = df.parse(event.getDtStart().toString());
DateIterator date = DateIteratorFactory.createDateIterator("RRULE:" + event.getrRule(), d, TimeZone.getTimeZone(event.getTimeZone()), true);
} catch (ParseException e) {
e.printStackTrace();
}
I think the problem is my DTStart is malformed but honestly at this point I have no idea. It's formatting is odd.
Suggestions?
I figured out the issue and its pretty silly. So I am using this library for building the rrule on the front end with .js
The rrule that is being output looks like this.
'FREQ=MONTHLY;DTSTART=20000201T060000Z;INTERVAL=454;WKST=SU;BYHOUR=10;BYMINUTE=47;BYSECOND=5;BYDAY=TH'
You CAN'T have dtstart inside the rrule. So I removed and built it with this.
String rrule = event.getrRule().replaceAll("(DTSTART.*?;)","");
DateTimeIterator date2 = DateTimeIteratorFactory.createDateTimeIterator("RRULE:" + rrule, event.getDtStart(),DateTimeZone.forTimeZone(TimeZone.getTimeZone(event.getTimeZone())), true);
and it works like a charm.
Hope this helps someone else!