How to use the platform/forms-system/src/js/definitions/currentOrPastDate function in platform

To help you get started, we’ve selected a few platform examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github department-of-veterans-affairs / vets-website / src / applications / hca / components / IDForm.jsx View on Github external
uiSchema = {
    firstName: {
      'ui:title': 'First name',
      'ui:errorMessages': {
        required: 'Please enter your first name.',
      },
    },
    lastName: {
      'ui:title': 'Last name',
      'ui:errorMessages': {
        required: 'Please enter your last name.',
      },
    },
    dob: {
      ...currentOrPastDateUI('Date of birth'),
      'ui:errorMessages': {
        required:
          'Please provide your date of birth. Select the month and day, then enter your birth year.',
      },
    },
    ssn: {
      ...ssnUI,
      'ui:errorMessages': {
        required:
          'Please enter your Social Security number in this format: XXX-XX-XXXX.',
        // NOTE: this `pattern` message is ignored because the pattern
        // validation error message is hard coded in the validation function:
        // https://github.com/usds/us-forms-system/blob/db029cb4f18362870d420e3eee5b71be98004e5e/src/js/validation.js#L231
        pattern:
          'Please enter your Social Security number in this format: XXX-XX-XXXX.',
      },
github department-of-veterans-affairs / vets-website / src / applications / burials / config / form.js View on Github external
required: ['veteranFullName', 'veteranDateOfBirth'],
            properties: {
              veteranFullName,
              veteranSocialSecurityNumber,
              vaFileNumber,
              veteranDateOfBirth,
              placeOfBirth,
            },
          },
        },
        burialInformation: {
          title: 'Burial information',
          path: 'veteran-information/burial',
          uiSchema: {
            deathDate: currentOrPastDateUI('Date of death'),
            burialDate: currentOrPastDateUI(
              'Date of burial (includes cremation or interment)',
            ),
            'view:burialDateWarning': {
              'ui:description': burialDateWarning,
              'ui:options': {
                hideIf: formData => {
                  // If they haven’t entered a complete year, don’t jump the gun and show the warning
                  if (formData.burialDate && !isFullDate(formData.burialDate)) {
                    return true;
                  }

                  // Show the warning if the burial date was more than 2 years ago
                  return isEligibleNonService(formData.burialDate);
                },
              },
            },
github department-of-veterans-affairs / vets-website / src / applications / pensions / config / form.js View on Github external
'ui:title': SpouseMarriageTitle,
                spouseFullName: _.merge(fullNameUI, {
                  first: {
                    'ui:title': 'Their spouse’s first name',
                  },
                  last: {
                    'ui:title': 'Their spouse’s last name',
                  },
                  middle: {
                    'ui:title': 'Their spouse’s middle name',
                  },
                  suffix: {
                    'ui:title': 'Their spouse’s suffix',
                  },
                }),
                dateOfMarriage: _.merge(currentOrPastDateUI(''), {
                  'ui:options': {
                    updateSchema: createSpouseLabelSelector(
                      spouseName =>
                        `Date of ${spouseName.first} ${
                          spouseName.last
                        }’s marriage`,
                    ),
                  },
                }),
                locationOfMarriage: {
                  'ui:options': {
                    updateSchema: createSpouseLabelSelector(
                      spouseName =>
                        `Place of ${spouseName.first} ${
                          spouseName.last
                        }’s marriage (city and state or foreign country)`,
github department-of-veterans-affairs / vets-website / src / applications / pensions / config / form.js View on Github external
'view:hasDependents': {
              'ui:title': 'Do you have any dependent children?',
              'ui:widget': 'yesNo',
            },
            dependents: {
              'ui:options': {
                itemName: 'Dependent',
                expandUnder: 'view:hasDependents',
                viewField: DependentField,
              },
              'ui:errorMessages': {
                minItems: dependentsMinItem,
              },
              items: {
                fullName: fullNameUI,
                childDateOfBirth: currentOrPastDateUI('Date of birth'),
              },
            },
          },
          schema: {
            type: 'object',
            required: ['view:hasDependents'],
            properties: {
              'view:hasDependents': {
                type: 'boolean',
              },
              dependents: {
                type: 'array',
                minItems: 1,
                items: {
                  type: 'object',
                  required: ['fullName', 'childDateOfBirth'],
github department-of-veterans-affairs / vets-website / src / applications / disability-benefits / all-claims / pages / unemployabilityDates.js View on Github external
disabilityAffectedEmploymentFullTimeDate,
  lastWorkedFullTimeDate,
  becameTooDisabledToWorkDate,
} = fullSchema.properties.form8940.properties.unemployability.properties;

export const uiSchema = {
  'ui:title': unemployabilityTitle,
  'ui:description': dateDescription,
  unemployability: {
    disabilityAffectedEmploymentFullTimeDate: currentOrPastDateUI(
      'Approximately when did you become too disabled to work? (If you don’t remember the exact date, you can give us an estimated date.)',
    ),
    lastWorkedFullTimeDate: currentOrPastDateUI(
      'When did you last work full-time?',
    ),
    becameTooDisabledToWorkDate: currentOrPastDateUI(
      'When did your disability begin to affect your full-time job?',
    ),
    'view:unemployabilityDatesDesc': {
      'ui:description': dateFieldsDescription,
    },
  },
};

export const schema = {
  type: 'object',
  properties: {
    unemployability: {
      type: 'object',
      required: ['disabilityAffectedEmploymentFullTimeDate'],
      properties: {
        disabilityAffectedEmploymentFullTimeDate,
github department-of-veterans-affairs / vets-website / src / applications / pre-need / config / form.jsx View on Github external
},
                  },
                },
                isDeceased: {
                  'ui:title': 'Has the sponsor died?',
                  'ui:widget': 'radio',
                  'ui:options': {
                    labels: {
                      yes: 'Yes',
                      no: 'No',
                      unsure: 'I don’t know',
                    },
                  },
                },
                dateOfDeath: _.merge(
                  currentOrPastDateUI('Sponsor’s date of death'),
                  {
                    'ui:options': {
                      expandUnder: 'isDeceased',
                      expandUnderCondition: 'yes',
                    },
                  },
                ),
                'ui:validations': [validateSponsorDeathDate],
              }),
            },
          },
          schema: {
            type: 'object',
            properties: {
              application: {
                type: 'object',
github department-of-veterans-affairs / vets-website / src / applications / pensions / config / form.js View on Github external
'ui:title':
                'Social Security number (must have this or a VA file number)',
              'ui:required': form => !form.vaFileNumber,
            }),
            vaFileNumber: {
              'ui:title':
                'VA file number (must have this or a Social Security number)',
              'ui:required': form => !form.veteranSocialSecurityNumber,
              'ui:options': {
                widgetClassNames: 'usa-input-medium',
              },
              'ui:errorMessages': {
                pattern: 'Your VA file number must be 8 or 9 digits',
              },
            },
            veteranDateOfBirth: currentOrPastDateUI('Date of birth'),
          },
          schema: {
            type: 'object',
            required: ['veteranFullName', 'veteranDateOfBirth'],
            properties: {
              veteranFullName,
              veteranSocialSecurityNumber,
              vaFileNumber,
              veteranDateOfBirth,
            },
          },
        },
      },
    },
    militaryHistory: {
      title: 'Military history',
github department-of-veterans-affairs / vets-website / src / applications / pre-need / config / form.jsx View on Github external
}),
                militaryServiceNumber: {
                  'ui:title':
                    'Sponsor’s Military Service number (if they have one that’s different than their Social Security number)',
                },
                vaClaimNumber: {
                  'ui:title': 'Sponsor’s VA claim number (if known)',
                  'ui:errorMessages': {
                    pattern: 'Your VA claim number must be 8 or 9 digits',
                  },
                },
                ssn: {
                  ...ssnDashesUI,
                  'ui:title': 'Sponsor’s Social Security number',
                },
                dateOfBirth: currentOrPastDateUI('Sponsor’s date of birth'),
                placeOfBirth: {
                  'ui:title': 'Sponsor’s place of birth',
                },
                gender: {
                  'ui:title': 'Sponsor’s gender',
                },
                maritalStatus: {
                  'ui:title': 'Sponsor’s marital status',
                },
                militaryStatus: {
                  'ui:title':
                    'Sponsor’s current military status (You can add more service history information later in this application)',
                  'ui:options': {
                    nestedContent: {
                      X: sponsorMilitaryStatusDescription,
                    },
github department-of-veterans-affairs / vets-website / src / applications / edu-benefits / 5490 / config / form.js View on Github external
},
          },
        },
        benefitRelinquishment: {
          title: 'Benefits relinquishment',
          path: 'benefits/relinquishment',
          initialData: {},
          depends: {
            relationship: 'child',
          },
          uiSchema: {
            'ui:title': 'Benefits relinquishment',
            'view:benefitsRelinquishedInfo': {
              'ui:description': benefitsRelinquishedInfo,
            },
            benefitsRelinquishedDate: currentOrPastDateUI('Effective date'),
            'view:benefitsRelinquishedWarning': {
              'ui:description': benefitsRelinquishedWarning,
            },
          },
          schema: {
            type: 'object',
            required: ['benefitsRelinquishedDate'],
            properties: {
              'view:benefitsRelinquishedInfo': {
                type: 'object',
                properties: {},
              },
              benefitsRelinquishedDate,
              'view:benefitsRelinquishedWarning': {
                type: 'object',
                properties: {},
github department-of-veterans-affairs / vets-website / src / applications / pensions / config / form.js View on Github external
disabilities: {
              'ui:title': 'What disabilities prevent you from working?',
              'ui:order': ['name', 'disabilityStartDate'],
              'ui:options': {
                viewField: DisabilityField,
                reviewTitle: 'Disability history',
                itemName: 'Disability',
              },
              'ui:errorMessages': {
                minItems: 'Please add at least one disability.',
              },
              items: {
                name: {
                  'ui:title': 'Disability',
                },
                disabilityStartDate: currentOrPastDateUI(
                  'Date disability began',
                ),
              },
            },
            'view:hasVisitedVAMC': {
              'ui:title':
                'Have you been treated at a VA medical center for the above disability?',
              'ui:widget': 'yesNo',
            },
            vamcTreatmentCenters: {
              'ui:description':
                'Please enter all VA medical centers where you have received treatment',
              'ui:options': {
                viewField: MedicalCenterField,
                itemName: 'Medical Center',
                expandUnder: 'view:hasVisitedVAMC',