Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T#2490/fix gem validation #2598

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions dashboard-prime/src/components/badges/EditBadge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { computed, nextTick, onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import SkillsInputFormDialog from '@/components/utils/inputForm/SkillsInputFormDialog.vue'
import { useAppConfig } from '@/common-components/stores/UseAppConfig.js'
import { array, date, number, object, string } from 'yup'
import { array, date, number, object, string, tuple } from 'yup'
import { useSkillsAnnouncer } from '@/common-components/utilities/UseSkillsAnnouncer.js'
import SkillsNameAndIdInput from '@/components/utils/inputForm/SkillsNameAndIdInput.vue'
import MarkdownEditor from '@/common-components/utilities/markdown/MarkdownEditor.vue'
Expand Down Expand Up @@ -103,11 +103,10 @@ const schema = object({
then: (sch) => sch.max(maximumDays.value - 1),
otherwise: (sch) => sch.max(maximumDays.value)
}),
'gemDates': array().of(date().label('Date Range'))
.label('Gem Date')
.min(2)
.max(2)
.test('notInPast', 'End date can not be in the past', (value) => {
'gemDates': tuple([
date().label('Start date').required('You must select a start date'),
date().label('End date').required('You must select an end date')
]).label('Gem Date').test('notInPast', 'End date can not be in the past', (value) => {
let valid = true;
// only trigger this validation on new badge entry, not edits
if(value && value.length === 2) {
Expand Down
Loading