| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta charset='utf-8' /> |
| 5 |
<link href='../../dist/fullcalendar.css' rel='stylesheet' /> |
| 6 |
<link href='../../dist/fullcalendar.print.css' rel='stylesheet' media='print' /> |
| 7 |
<script src='../../node_modules/moment/moment.js'></script> |
| 8 |
<script src='../../node_modules/jquery/dist/jquery.js'></script> |
| 9 |
<script src='../../dist/fullcalendar.js'></script> |
| 10 |
<script> |
| 11 |
|
| 12 |
$(document).ready(function() { |
| 13 |
|
| 14 |
$('#calendar').fullCalendar({ |
| 15 |
headerToolbar: { |
| 16 |
left: 'prev,next today', |
| 17 |
center: 'title', |
| 18 |
right: 'month,week,day' |
| 19 |
}, |
| 20 |
initialDate: '2014-04-05', |
| 21 |
initialView: 'day', |
| 22 |
selectable: true, |
| 23 |
timeZone: 'local', |
| 24 |
dayClick: function(date) { |
| 25 |
console.log('dayClick', date.format()); |
| 26 |
}, |
| 27 |
select: function(start, end) { |
| 28 |
console.log('select', start.format(), end.format(), start.isBefore(end)); |
| 29 |
var title = prompt('Event Title:'); |
| 30 |
var eventData; |
| 31 |
if (title) { |
| 32 |
eventData = { |
| 33 |
title: title, |
| 34 |
start: start, |
| 35 |
end: end |
| 36 |
}; |
| 37 |
$('#calendar').fullCalendar('renderEvent', eventData, true); // stick? = true |
| 38 |
} |
| 39 |
$('#calendar').fullCalendar('unselect'); |
| 40 |
} |
| 41 |
}); |
| 42 |
|
| 43 |
}); |
| 44 |
|
| 45 |
</script> |
| 46 |
<style> |
| 47 |
|
| 48 |
body { |
| 49 |
margin: 40px 10px; |
| 50 |
padding: 0; |
| 51 |
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; |
| 52 |
font-size: 14px; |
| 53 |
} |
| 54 |
|
| 55 |
#calendar { |
| 56 |
max-width: 900px; |
| 57 |
margin: 0 auto; |
| 58 |
} |
| 59 |
|
| 60 |
</style> |
| 61 |
</head> |
| 62 |
<body> |
| 63 |
|
| 64 |
<p style='text-align:center;margin-bottom: 3em'> |
| 65 |
To recreate, set computer's timezone to Australia/Sydney, open in Safari, and try to select any time after 3pm. |
| 66 |
</p> |
| 67 |
|
| 68 |
<div id='calendar'></div> |
| 69 |
|
| 70 |
</body> |
| 71 |
</html> |