add switch tab event and set correct date functionality