Calendar limit

Search This thread

fredpel

Member
Mar 23, 2011
34
3
Hello,
I just started using Zooper so I don't know yet every command and parameter.
On my widget I have 3 lines that display the next 3 calendar events in the format "TUE 8 18:00 EVENT", but "next event" may be coming way far in the future. I'd like to limit events to those of the next 2 weeks (I don't need to know about things that are months away), how can I do that?

Thank you
 

Koadics

Member
Apr 13, 2011
8
2
"next event" may be coming way far in the future. I'd like to limit events to those of the next 2 weeks (I don't need to know about things that are months away), how can I do that?Thank you

I'm rather new to Zooper Widget myself, but I would think that you could make a conditional statement that takes the difference of the date of the event and the current date and if that is < 14, then do the following. Note that I have not tested any of the following, so you would probably have to debug and troubleshoot any issues if some arise.

$#C0SMMdd#-#DMMdd#<=14? #C0TITLE#$
To my understanding, this would say
If (First Calendar event month and Day) - (Current Month and Day) <= 14, then display the name of the first event.

However, there is one flaw with this formula, since it the values would be incorrect the following month (For example the 29th of April would yield the value "0429" and the first of May would be "0501", but the difference is well over 14, but they are within 2 weeks of one another).

Since the difference in months should be the 100s place, you might be able to just do another if statement that says
$[#C0SMMdd#-#DMMdd#>=73] && [#C0SMMdd#-#DMMdd#<=86] [&& #C0SMMdd#-#DMMdd#<-1000]? #C0TITLE#$
I didn't spend a whole lot of time on these numbers, so there may be a few errors. I thought of the worse scenario (Being the last day of February and an event on the next day (0301-0228=73)) and the other scenario being a cap so that you don't get events in the long distant future. The last is for the change of December to January.

As a said, I am rather new to using zooper, so there may be an easier way to do this. If not I hope this helped get you started.
 

fredpel

Member
Mar 23, 2011
34
3
That's definitely a good starting point, I went for
Code:
$#C0yDDD#-#DyDDD#<15?#C0TITLE#$

yDDD gives the date in the format 2014170 (year + day in year with leading zeros, from 001 to 365), so it should be ok in every case

Now I just have to fight with text jumping up and down whether the contain tall letters or not

Thank you very much!

(btw is there a way to stop the configuration window from closing and forgetting what I wrote, if the screen turns off while I'm changing something?)
 
Last edited:

Koadics

Member
Apr 13, 2011
8
2
(btw is there a way to stop the configuration window from closing and forgetting what I wrote, if the screen turns off while I'm changing something?)

Sadly, I'm not aware of a way to do that. Although, a lot of people use pushbullet and write the code on their computer and then send it to their phone to test.