Release ical viewer (alpha)

if i have nothing in it it's ok
if i have one ical string it it works
if i have two icals strings separated with a ";" it works
add a 3rd and it gives a 500 error on saving.

tried using diffent combinations of the 3 strings to see if it was one particular but all work on their own or as a pair but not as a 3sum

>1024 characters or embedded spaces?

dont know, need to recrete it and count it in word

why dons this work, i know im repeating but it still should work, it runs upto and including log.debug "filltered" then throws org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: java.util.ArrayList.values() is applicable for argument types: () values: []
Possible solutions: plus(java.lang.Object), plus(java.lang.Iterable), plus(java.lang.Object), plus(java.lang.Object), plus(java.util.Collection), plus(java.lang.Iterable) (getdata)

iCalMap.event = iCalMap.event.values()sort{ a, b -> a.start <=> b.start} //sort the data
log.debug "sorted"
iCalMap.event = iCalMap.event.unique()
log.debug "filltered"
iCalMap.event = iCalMap.event.values()sort{ a, b -> a.start <=> b.start} //sort the data
iCalMap.event = iCalMap.event.unique()
log.debug "fileter sorted again"

edit 3 icals
image

code to split

   try {
        icalinks = icalink.split(";")
        icalinks.each { it ->

Looks like maybe an empty list.... What does iCalMap.event.size() return?

So getting through the first sort and unique, but error on the second sort?

Yea fails 2nd sort

Just taking a shot in the dark now, but does * iCalMap.event.start* still evaluate to something after the .unique()?

updated added 7 day countdown minor enhancements

yea

ive got it working it was the differance between these (2nd working)
iCalMap.event = iCalMap.event.values()sort{ a, b -> a.start <=> b.start} //sort the data iCalMap.event = iCalMap.event.sort{ a, b -> a.start <=> b.start} //sort the data

I just cant seem to add a day to the start date

if (it.repeatFreq){
           // log.debug "${it.summary} freq ${it.repeatFreq} ${it.repeatNum}"
            if (it.repeatFreq.contains("DAILY") && it.repeatNum.toInteger() <= 0){ //RRULE:FREQ=DAILY;WKST=TU // SEQUENCE:1 //!it.repeatFreq.contains("INTERVAL") &&
               log.debug "${fullstart} and ${it.repeatNum} and ${it.repeatFreq} and ${it.repeatNum} --- ${it}"
                def num = it.repeatNum.toInteger()+1
                //log.debug num
                //fullstart = fullstart + num.day //add dd to time string

To get tomorrow I'd normally do something like:

new Date().plus(1)

so in theory if fullstart contains a date object and num.dd is an integer:

fullstart.plus(num.dd)

should allow you to add days to it

cool ill look into it, what about months and years?

def num = it.repeatNum.toInteger()+1
                log.debug it.start
                it.start = fullstart.plus(num.dd) //add dd to time string
                log.debug it.start

A little more interesting:

import groovy.time.TimeCategory
...
    use(TimeCategory){
        it.startY  = fullstart + numYear.year
        it.startM  = fullstart + numMonth.month
    }

ive got this to kinda work but still need to understand how the ical formats repeats

if (it.repeatFreq.contains("DAILY") && it.repeatNum.toInteger() <= 0){ //RRULE:FREQ=DAILY;WKST=TU // SEQUENCE:1 //!it.repeatFreq.contains("INTERVAL") &&
               log.debug "original ${it.start} & ${it.end} --- ${it}"
                
                def num = it.repeatNum.toInteger()+1
                
                use(TimeCategory){
                    fullstart = fullstart + num.day //add dd to time string /it.startY  = fullstart + numYear.year
                    fullend = fullend + num.day
                }
                it.start = fullstart.toString()
                it.end = fullend.toString()
                log.debug "adjusted ${it.start} & ${it.end}"
            }

another bug

private timeHelp(data) {
//log.debug "timeHelp data= $data"
    Date zDate
    if (data.contains("Z")) zDate =  toDateTime(data)
    else if (data.contains("T")) zDate = new SimpleDateFormat("yyyyMMdd'T'kkmmss").parse(data)
    else zDate = new SimpleDateFormat("yyyyMMdd").parse(data)
//log.debug "zDate= $zDate"
    String localTime = new SimpleDateFormat("HH:mm").format(zDate)
    String dateTrim = new SimpleDateFormat("dd-MM-yy").format(zDate)
//log.debug "timeHelp return=$zDate & $localTime & $dateTrim"     
    return [localTime, dateTrim,zDate]
}

im guessing its struggling because its already in a date and time format?

It’s seeing the β€œT” in GMT and using the wrong format to try and parse. Could try to place this above the current β€œT” else:

else if (data.contains("GMT")) zDate = new SimpleDateFormat("EEE LLL dd kk:mm:ssβ€˜ GMT 'yyyy").parse(data)

240 is the new line

Try this instead:

else if(data.contains("GMT")) zDate = new SimpleDateFormat("EEE MMM dd kk:mm:ss 'GMT' yyyy").parse(data)

That got it thanks, working with dates seems very complicated

1 Like