Skip to content

Commit

Permalink
wave of fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Midge-dev committed Jan 17, 2025
1 parent 3bb33e7 commit 0900cd0
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ export const studentAssetsPage = {
),
},
otherAssets: textUI('All other assets'),
totalValue: textUI('All other assets'),
totalValue: textUI('Total value'),
},
},
schema: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const uiSchema = {
classNames: 'vads-u-margin-top--4',
}),
other: textUI({
title: 'Briefly describe why you live separately',
title: 'Briefly describe why you live separately from your spouse',
required: formData =>
formData?.doesLiveWithSpouse?.currentSpouseReasonForSeparation ===
'OTHER',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ export const formerMarriageEndReasonPage = {
reasonMarriageEndedOther: {
...textUI('Briefly describe how their marriage ended'),
'ui:required': (formData, index) => {
// See above comment
const isEditMode = formData?.reasonMarriageEnded === 'Other';
const isAddMode =
formData?.spouseMarriageHistory?.[index]?.reasonMarriageEnded ===
Expand Down Expand Up @@ -183,6 +182,24 @@ export const formerMarriageEndDatePage = {
endDate: {
...currentOrPastDateUI('When did their marriage end?'),
'ui:required': () => true,
'ui:validations': [
{
validator: (errors, _field, formData) => {
const { startDate, endDate } = formData;

if (!startDate || !endDate) return;

const start = new Date(startDate);
const end = new Date(endDate);

if (end < start) {
errors.addError(
'Marriage end date must be the on or after the marriage start date',
);
}
},
},
],
},
},
schema: {
Expand Down Expand Up @@ -221,7 +238,6 @@ export const formerMarriageStartLocationPage = {
'ui:title': 'State',
'ui:webComponentField': VaSelectField,
'ui:required': (formData, index) => {
// See above comment
const isEditMode = formData?.startLocation?.outsideUsa;
const isAddMode =
formData?.spouseMarriageHistory?.[index]?.startLocation
Expand All @@ -231,7 +247,6 @@ export const formerMarriageStartLocationPage = {
},
'ui:options': {
hideIf: (formData, index) =>
// See above comment
formData?.startLocation?.outsideUsa ||
formData?.spouseMarriageHistory?.[index]?.startLocation
?.outsideUsa,
Expand Down Expand Up @@ -282,7 +297,6 @@ export const formerMarriageEndLocationPage = {
'ui:title': 'State',
'ui:webComponentField': VaSelectField,
'ui:required': (formData, index) => {
// See above comment
const isEditMode = formData?.endLocation?.outsideUsa;
const isAddMode =
formData?.spouseMarriageHistory?.[index]?.endLocation?.outsideUsa;
Expand All @@ -291,7 +305,6 @@ export const formerMarriageEndLocationPage = {
},
'ui:options': {
hideIf: (formData, index) =>
// See above comment
formData?.endLocation?.outsideUsa ||
formData?.spouseMarriageHistory?.[index]?.endLocation?.outsideUsa,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import VaSelectField from 'platform/forms-system/src/js/web-component-fields/VaS
import VaCheckboxField from 'platform/forms-system/src/js/web-component-fields/VaCheckboxField';
import {
marriageEnums,
spouseFormerMarriageLabels,
veteranFormerMarriageLabels,
customLocationSchema,
generateHelpText,
} from '../../helpers';
Expand Down Expand Up @@ -125,7 +125,7 @@ export const vetFormerMarriageEndReasonPage = {
...radioUI({
title: 'How did your marriage end?',
required: () => true,
labels: spouseFormerMarriageLabels,
labels: veteranFormerMarriageLabels,
}),
},
reasonMarriageEndedOther: {
Expand Down Expand Up @@ -162,7 +162,7 @@ export const vetFormerMarriageStartDatePage = {
return 'Your former marriage';
}),
startDate: {
...currentOrPastDateUI('When did they get married?'),
...currentOrPastDateUI('When did you get married?'),
'ui:required': () => true,
},
},
Expand All @@ -180,8 +180,26 @@ export const vetFormerMarriageEndDatePage = {
return 'Your former marriage';
}),
endDate: {
...currentOrPastDateUI('When did their marriage end?'),
...currentOrPastDateUI('When did your marriage end?'),
'ui:required': () => true,
'ui:validations': [
{
validator: (errors, _field, formData) => {
const { startDate, endDate } = formData;

if (!startDate || !endDate) return;

const start = new Date(startDate);
const end = new Date(endDate);

if (end < start) {
errors.addError(
'Marriage end date must be the on or after the marriage start date',
);
}
},
},
],
},
},
schema: {
Expand All @@ -198,7 +216,7 @@ export const vetFormerMarriageStartLocationPage = {
return 'Your former marriage';
}),
startLocation: {
'ui:title': 'Where did they get married?',
'ui:title': 'Where did you get married?',
'ui:options': {
labelHeaderLevel: '4',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const householdChildInfoPage = {
title: 'Remove a stepchild who has left your household',
nounSingular: removeChildHouseholdOptions.nounSingular,
}),
fullName: fullNameNoSuffixUI(),
fullName: fullNameNoSuffixUI(title => `Child’s ${title}`),
ssn: {
...ssnUI('Child’s Social Security number'),
'ui:required': () => true,
Expand Down

0 comments on commit 0900cd0

Please sign in to comment.