Skip to content

Commit

Permalink
fixed batch current students date greying out button
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunlumbcgov committed May 7, 2024
1 parent 906162e commit 2c14804
Showing 1 changed file with 44 additions and 42 deletions.
86 changes: 44 additions & 42 deletions frontend/src/components/Batch/Batch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1113,27 +1113,28 @@ export default {
isDateInvalid: helpers.withMessage(
"Enter a valid end date",
(value) => {
const regex = /^\d{4}-\d{2}-\d{2}$/;
if (
this.batch.details["gradDate"] == "Date Range" &&
regex.test(value) // Check if the date format is valid
) {
// Split the date string into year, month, and day parts
const parts = value.split('-');
const year = parseInt(parts[0]);
const month = parseInt(parts[1]) - 1; // Months are zero-indexed
const day = parseInt(parts[2]);
// Create a Date object and check if it represents a valid date
const date = new Date(year, month, day);
return (
date.getFullYear() === year &&
date.getMonth() === month &&
date.getDate() === day
);
} else {
return false;
}
if(this.batch.details["gradDate"] == "Date Range"){
const regex = /^\d{4}-\d{2}-\d{2}$/;
if (regex.test(value)){ // Check if the date format is valid
// Split the date string into year, month, and day parts
const parts = value.split('-');
const year = parseInt(parts[0]);
const month = parseInt(parts[1]) - 1; // Months are zero-indexed
const day = parseInt(parts[2]);
// Create a Date object and check if it represents a valid date
const date = new Date(year, month, day);
return (
date.getFullYear() === year &&
date.getMonth() === month &&
date.getDate() === day
);
} else {
return false;
}
}else{ return true }
}
),
isValidFromDate: helpers.withMessage(
Expand All @@ -1157,27 +1158,28 @@ export default {
isDateInvalid: helpers.withMessage(
"Enter a valid end date",
(value) => {
const regex = /^\d{4}-\d{2}-\d{2}$/;
if (
this.batch.details["gradDate"] == "Date Range" &&
regex.test(value) // Check if the date format is valid
) {
// Split the date string into year, month, and day parts
const parts = value.split('-');
const year = parseInt(parts[0]);
const month = parseInt(parts[1]) - 1; // Months are zero-indexed
const day = parseInt(parts[2]);
// Create a Date object and check if it represents a valid date
const date = new Date(year, month, day);
return (
date.getFullYear() === year &&
date.getMonth() === month &&
date.getDate() === day
);
} else {
return false;
}
if(this.batch.details["gradDate"] == "Date Range"){
const regex = /^\d{4}-\d{2}-\d{2}$/;
if (regex.test(value)){ // Check if the date format is valid
// Split the date string into year, month, and day parts
const parts = value.split('-');
const year = parseInt(parts[0]);
const month = parseInt(parts[1]) - 1; // Months are zero-indexed
const day = parseInt(parts[2]);
// Create a Date object and check if it represents a valid date
const date = new Date(year, month, day);
return (
date.getFullYear() === year &&
date.getMonth() === month &&
date.getDate() === day
);
} else {
return false;
}
}else{ return true }
}
),
isValidFromDate: helpers.withMessage(
Expand Down

0 comments on commit 2c14804

Please sign in to comment.