Skip to content
Extraits de code Groupes Projets
Valider 133f6935 rédigé par DavePk04's avatar DavePk04
Parcourir les fichiers

Fix backward availability issue: Prevent users from selecting end time earlier than start time

parent 18a2d351
Aucune branche associée trouvée
Aucune étiquette associée trouvée
2 requêtes de fusion!43Merge dev into main,!39Fix backward availability issue: Prevent users from selecting end time earlier than start time
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
let selectedStudy: Study | undefined = $state(); let selectedStudy: Study | undefined = $state();
let tutors = $state(data.tutors || []); let tutors = $state(data.tutors || []);
console.log('data:', data);
let isLoading = $state(false); let isLoading = $state(false);
let selectedTutorEmail = $state(''); let selectedTutorEmail = $state('');
let is_tutor = $state(false); let is_tutor = $state(false);
...@@ -116,19 +115,29 @@ ...@@ -116,19 +115,29 @@
bio = target.value; bio = target.value;
remainingCharacters = MAX_BIO_LENGTH - bio.length; remainingCharacters = MAX_BIO_LENGTH - bio.length;
} }
function addAvailability(): void { function addAvailability(): void {
if (selectedWeekday && selectedTimeStart && selectedTimeEnd) { if (!selectedWeekday || !selectedTimeStart || !selectedTimeEnd) {
availability.push({ console.error('All fields must be selected.');
day: selectedWeekday, return;
start: selectedTimeStart, }
end: selectedTimeEnd const startHour = parseInt(selectedTimeStart.split(':')[0]);
}); const endHour = parseInt(selectedTimeEnd.split(':')[0]);
selectedWeekday = '';
selectedTimeStart = ''; if (startHour >= endHour) {
selectedTimeEnd = ''; alert('End time must be later than start time.');
} else { return;
console.error('Failed to add availability. Make sure all fields are selected.');
} }
availability.push({
day: selectedWeekday,
start: selectedTimeStart,
end: selectedTimeEnd
});
selectedWeekday = '';
selectedTimeStart = '';
selectedTimeEnd = '';
} }
function removeAvailability(index: number): void { function removeAvailability(index: number): void {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter