refactor calendar.js