locales.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset='utf-8' />
  5. <script src='../../packages/core/dist/index.global.js'></script>
  6. <script src='../../packages/core/dist/locales-all.global.js'></script>
  7. <script src='../../packages/daygrid/dist/index.global.js'></script>
  8. <script src='../../packages/timegrid/dist/index.global.js'></script>
  9. <script src='../../packages/list/dist/index.global.js'></script>
  10. <script src='../../packages/multimonth/dist/index.global.js'></script>
  11. <script>
  12. document.addEventListener('DOMContentLoaded', function() {
  13. var initialLocaleCode = 'en';
  14. var localeSelectorEl = document.getElementById('locale-selector');
  15. var calendarEl = document.getElementById('calendar');
  16. var calendar = new FullCalendar.Calendar(calendarEl, {
  17. headerToolbar: {
  18. left: 'prev,next today',
  19. center: 'title',
  20. right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth,multiMonthYear'
  21. },
  22. initialDate: '2020-09-12',
  23. locale: initialLocaleCode,
  24. buttonIcons: false, // show the prev/next text
  25. weekNumbers: true,
  26. navLinks: true, // can click day/week names to navigate views
  27. editable: true,
  28. dayMaxEvents: true, // allow "more" link when too many events
  29. events: [
  30. {
  31. title: 'All Day Event',
  32. start: '2020-09-01'
  33. },
  34. {
  35. title: 'Long Event',
  36. start: '2020-09-07',
  37. end: '2020-09-10'
  38. },
  39. {
  40. groupId: 999,
  41. title: 'Repeating Event',
  42. start: '2020-09-09T16:00:00'
  43. },
  44. {
  45. groupId: 999,
  46. title: 'Repeating Event',
  47. start: '2020-09-16T16:00:00'
  48. },
  49. {
  50. title: 'Conference',
  51. start: '2020-09-11',
  52. end: '2020-09-13'
  53. },
  54. {
  55. title: 'Meeting',
  56. start: '2020-09-12T10:30:00',
  57. end: '2020-09-12T12:30:00'
  58. },
  59. {
  60. title: 'Lunch',
  61. start: '2020-09-12T12:00:00'
  62. },
  63. {
  64. title: 'Meeting',
  65. start: '2020-09-12T14:30:00'
  66. },
  67. {
  68. title: 'Happy Hour',
  69. start: '2020-09-12T17:30:00'
  70. },
  71. {
  72. title: 'Dinner',
  73. start: '2020-09-12T20:00:00'
  74. },
  75. {
  76. title: 'Birthday Party',
  77. start: '2020-09-13T07:00:00'
  78. },
  79. {
  80. title: 'Click for Google',
  81. url: 'http://google.com/',
  82. start: '2020-09-28'
  83. }
  84. ]
  85. });
  86. calendar.render();
  87. // build the locale selector's options
  88. calendar.getAvailableLocaleCodes().forEach(function(localeCode) {
  89. var optionEl = document.createElement('option');
  90. optionEl.value = localeCode;
  91. optionEl.selected = localeCode == initialLocaleCode;
  92. optionEl.innerText = localeCode;
  93. localeSelectorEl.appendChild(optionEl);
  94. });
  95. // when the selected option changes, dynamically change the calendar option
  96. localeSelectorEl.addEventListener('change', function() {
  97. if (this.value) {
  98. calendar.setOption('locale', this.value);
  99. }
  100. });
  101. });
  102. </script>
  103. <style>
  104. body {
  105. margin: 0;
  106. padding: 0;
  107. font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
  108. font-size: 14px;
  109. }
  110. #top {
  111. background: #eee;
  112. border-bottom: 1px solid #ddd;
  113. padding: 0 10px;
  114. line-height: 40px;
  115. font-size: 12px;
  116. }
  117. #calendar {
  118. max-width: 1100px;
  119. margin: 40px auto;
  120. padding: 0 10px;
  121. }
  122. </style>
  123. </head>
  124. <body>
  125. <div id='top'>
  126. Locales:
  127. <select id='locale-selector'></select>
  128. </div>
  129. <div id='calendar'></div>
  130. </body>
  131. </html>