Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="calendar">
- <table>
- <tr>
- <th><h4>PON</h4></th>
- <th><h4>WTO</h4></th>
- <th><h4>SRO</h4></th>
- <th><h4>CZW</h4></th>
- <th><h4>PIĄ</h4></th>
- <th><h4>SOB</h4></th>
- <th><h4>NIE</h4></th>
- </tr>
- </table>
- </div>
- var Calendar = {
- customDate: function (date) {
- return new Date(date)
- },
- currentDay: function () {
- return new Date().getDay();
- },
- currentMonth: function () {
- return new Date().getMonth() + 1;
- },
- currentYear: function () {
- return new Date().getFullYear();
- },
- getMonthDays: function (year, month) {
- return new Date(year, month, 0).getDate();
- },
- currentMonthDays: function () {
- return this.getMonthDays(this.currentYear(), this.currentMonth());
- }
- Calendar.createCustomCalendar = function (month, year) {
- var currentDays = Calendar.getMonthDays(year, month),
- day = 1,
- monthDay = Calendar.currentDay(month, year),
- calendar = jQuery('.calendar'),
- table = calendar.find('table');
- calendar.prepend('<h2>' + month + ' ' + year + '</h2>');
- for (var row = 1; row <= Math.ceil(currentDays / 7); row++) {
- var tableRow = jQuery('<tr class="calendarRow"></tr>');
- for (col = 1; col <= 7 && day <= currentDays; col++, day++) {
- jQuery(tableRow).append('<td>' + day + '</td>');
- }
- table.append(tableRow);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement