Skip to content
This repository was archived by the owner on May 4, 2026. It is now read-only.

ctsit/prevent_past_or_future_dates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

This REDCap external module is deprecated because REDCap now has functionality to mimic it. Vanderbilt University Medical Center (VUMC) added the ability to use piping and/or today/now for the min/max ranges for date fields. In the example below, the date entered has to be between their visit date and today’s date:

recommended validation rules

To prevent a future date, you would use 'today ‘ (without quotes) for the maximum. To prevent a past date, you would use ’today’ (without quotes) for the minimum.

Prevent Past or Future Dates

DOI

This REDCap module adds actions tags @PREVENT-FUTUREDATE and @PREVENT-PASTDATE that can be applied to date fields - i.e., a text field with date validation applied - to disallow entry of dates in the future or past, respectively. The tags are mutually exclusive, applying both tags will not result in any date restrictions. To enforce today's date use the @TODAY action tag instead.

Prevent Future Date

Prerequisites

  • REDCap >= 14.0.2
  • PHP >= 7.4

Installation

  • Clone this repo into to <redcap-root>/modules/prevent_past_or_future_dates_v0.0.0.
  • Go to Control Center > Manage External Modules and enable Prevent Past or Future Dates.
  • For each project you want to use this module, go to the project home page, click on Manage External Modules link, and then enable Prevent Past or Future Dates for that project.

Expected Behavior

Scenarios

Applied Tags Dates available in Datepicker
Scenario 1 @PREVENT-FUTUREDATE past - today
Scenario 2 @PREVENT-PASTDATE today - future
Scenario 3 NOT SUPPORTED @PREVENT-FUTUREDATE && @PREVENT-PASTDATE N/A - supplying both tags will not apply any date restrictions use @TODAY instead

Existing Data

The action tags will only apply to empty fields; if data already exists in a field when the form is loaded the action tag will not apply to that field. This is to prevent annoyances when revisiting forms.

Date vs Datetime field

This module handles date fields and datetime fields slightly differently:

  • If a datetime field fails validation and the datetimepicker is opened and loses focus, the input will be updated automatically to the closest valid date.
  • If a date field fails validation and the datepicker is opened and loses focus, the input will not be updated automatically. A validation alert will display and the value will need to be updated manually.

About

[DEPRECATED] This REDCap module adds actions tags @PREVENT-FUTUREDATE and @PREVENT-PASTDATE that can be applied to date fields - i.e., a text field with date validation applied.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors