[Calendar applet] Reduce code redundancy