1# Testing Guide - Date Editing in Events 2 3## How to Test Date Editing 4 5### Test 1: Creating New Event with Date Selection 6 71. Open your calendar page: `{{calendar}}` 82. Click **+ Add** button 93. **Verify**: Date field should be visible and editable 104. Select a date (e.g., January 25, 2026) 115. Fill in Title: "Test Event" 126. Click **Save** 137. **Expected**: Event appears on January 25 14 15### Test 2: Editing Event Date from Popup 16 171. Click on a calendar day that has an event 182. Popup opens showing the event 193. Click **Edit** button 204. **Verify**: Date field shows current event date and is editable 215. Change date to a different day (e.g., from Jan 25 to Jan 28) 226. Click **Save** 237. **Expected**: 24 - Event disappears from Jan 25 25 - Event appears on Jan 28 26 - Calendar shows event on new date 27 28### Test 3: Editing Event Date from Event List Panel 29 301. Find an event in the right panel event list 312. Click **Edit** button 323. **Verify**: Date field is visible and shows event date 334. Change the date 345. Click **Save** 356. **Expected**: Event moves to new date 36 37### Test 4: Moving Event to Different Month 38 391. Edit an event currently in January 402. Change date to February 15, 2026 413. Click **Save** 424. **Expected**: 43 - Calendar automatically switches to February 44 - Event appears on February 15 45 - No longer visible in January 46 47## What the Date Field Should Look Like 48 49When editing an event, you should see: 50 51``` 52┌─────────────────────────┐ 53│ Edit Event │ 54├─────────────────────────┤ 55│ Date │ 56│ [2026-01-25] ▼ │ ← This should be editable! 57│ │ 58│ Title │ 59│ [Team Meeting] │ 60│ │ 61│ Time │ 62│ [14:00] │ 63│ │ 64│ Color │ 65│ [] │ 66│ │ 67│ Description │ 68│ [Weekly sync...] │ 69│ │ 70│ [Save] [Cancel] │ 71└─────────────────────────┘ 72``` 73 74## Troubleshooting 75 76### Issue: Date field not showing 77 78**Check**: 791. View page source (Ctrl+U) 802. Search for: `type="date"` 813. Should find: `<input type="date" id="event-date-cal_XXXXX" name="date" required>` 82 83**If not found**: Re-upload plugin files 84 85### Issue: Date field showing but disabled/grayed out 86 87**Check**: 881. Look at input element 892. Should NOT have: `readonly` or `disabled` attributes 903. Should have: `required` attribute only 91 92**If disabled**: Clear browser cache and reload page 93 94### Issue: Date changes but event doesn't move 95 96**Check**: 971. Open browser console (F12) 982. Edit event and change date 993. Click Save 1004. Look for errors in console 1015. Should see: Network request to `ajax.php` with `oldDate` parameter 102 103**If missing oldDate**: Check JavaScript console for errors 104 105### Issue: Calendar doesn't switch to new month 106 107**Check**: 1081. Change event date to different month 1092. Click Save 1103. Check browser console 1114. Should see: `reloadCalendarData` being called with new month 112 113## Expected Behavior Summary 114 115✅ **Date field IS visible** in add/edit dialog 116✅ **Date field IS editable** (can click and change) 117✅ **Calendar picker appears** when clicking date field 118✅ **Event moves** when date is changed 119✅ **Calendar switches** to new month automatically 120✅ **Old date is cleared** (event removed from original date) 121✅ **New date shows event** (appears with orange dot) 122 123## Code Verification 124 125The date field is created in `syntax.php`: 126 127```php 128$html .= '<div class="form-row">'; 129$html .= '<label>Date</label>'; 130$html .= '<input type="date" id="event-date-' . $calId . '" name="date" required>'; 131$html .= '</div>'; 132``` 133 134The date is populated when editing in `script.js`: 135 136```javascript 137document.getElementById('event-date-' + calId).value = date; 138document.getElementById('event-date-' + calId).setAttribute('data-original-date', date); 139``` 140 141The date change is handled in `script.js`: 142 143```javascript 144const dateInput = document.getElementById('event-date-' + calId); 145const date = dateInput.value; 146const oldDate = dateInput.getAttribute('data-original-date') || date; 147``` 148 149And processed in `action.php`: 150 151```php 152$date = $INPUT->str('date'); 153$oldDate = $INPUT->str('oldDate', ''); 154 155// If editing and date changed, remove from old date first 156if ($eventId && $oldDate && $oldDate !== $date) { 157 // ... code to remove from old date 158} 159``` 160 161## Browser Compatibility 162 163The `<input type="date">` field is supported by: 164- Chrome/Edge: ✅ Full support 165- Firefox: ✅ Full support 166- Safari: ✅ Full support 167- Mobile browsers: ✅ Full support 168 169If using very old browser, the date field will fall back to text input where you can type date in YYYY-MM-DD format. 170 171## Quick Test Script 172 173Open browser console and run: 174 175```javascript 176// Check if date field exists and is editable 177const dateField = document.querySelector('input[type="date"]'); 178if (dateField) { 179 console.log('✅ Date field found'); 180 console.log('Readonly:', dateField.readOnly); 181 console.log('Disabled:', dateField.disabled); 182 console.log('Current value:', dateField.value); 183} else { 184 console.log('❌ Date field not found - check plugin installation'); 185} 186``` 187 188Expected output: 189``` 190✅ Date field found 191Readonly: false 192Disabled: false 193Current value: 2026-01-25 194``` 195 196## Still Having Issues? 197 1981. **Clear browser cache** (Ctrl+Shift+Delete) 1992. **Hard refresh** the page (Ctrl+F5) 2003. **Check file permissions** on server 2014. **Verify all plugin files** are uploaded 2025. **Check PHP error log** for server-side issues 2036. **Test in different browser** to rule out browser issues 204 205## Success Indicators 206 207When everything is working correctly: 208 2091. ✅ You can click the date field 2102. ✅ A date picker calendar appears 2113. ✅ You can select any date 2124. ✅ When you save, event moves to new date 2135. ✅ Calendar automatically shows the new month 2146. ✅ No JavaScript errors in console 2157. ✅ Event appears on correct date immediately 216