File size: 588 Bytes
7285b64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Shared functions for the physics peer grading app

function getCurrentDateTime() {
  const now = new Date();
  const month = String(now.getMonth() + 1).padStart(2, '0');
  const day = String(now.getDate()).padStart(2, '0');
  const year = now.getFullYear();
  return `${month}/${day}/${year}`;
}

// Auto-fill date field on page load
document.addEventListener('DOMContentLoaded', function() {
  const dateField = document.getElementById('date');
  if (dateField && !dateField.value) {
    dateField.value = getCurrentDateTime();
  }
});

// Add any additional shared functionality here