Universal Field Validator

@UVWINDOW

@UVWINDOW is a REDCap action tag that checks a date lies in a window around another date, such as a visit 21 to 35 days after baseline, or is not in the future.

REDCap's date validation can set a fixed minimum and maximum date, and it only warns. It cannot say "21 to 35 days after this participant's baseline visit", and it has no notion of today. @UVWINDOW checks a date against a window around another date, today or a fixed date, or a calendar period such as last month, and/or that it is not in the future or not in the past, live as the date is entered.

Syntax

JSON form only. A from date with a window, a period, "notFuture": true or "notPast": true, or several of them.

@UVWINDOW={"from":"[visit_date_bl]","window":[21,35],"unit":"days"}

@UVWINDOW={"from":"[dob]","window":[0,null]}

@UVWINDOW={"notFuture":true}

@UVWINDOW={"notPast":true}

@UVWINDOW={"from":"today","window":[-7,0]}

@UVWINDOW={"period":"month","offset":-1}

@UVWINDOW={"period":"week","from":"[visit_date]","weekStart":"sunday"}

@UVWINDOW={"from":"[enrol_date]","window":[-7,7],"unit":"days","notFuture":true,
           "message":"The screening visit must be within a week of enrolment.",
           "blockSave":"hard"}
KeyMeaning
fromThe date the window counts from: one field reference such as [visit_date_bl], "today" (date fields), "now" (datetime fields) or a Y-M-D date such as "2026-01-01"
window[earliest, latest] in whole units from the from date, both ends included. null leaves an end open; negative numbers count back
unitdays (default), weeks, months or years; on datetime fields also minutes or hours. Months and years follow the calendar: one month after January 31 is the last day of February
periodweek, month, quarter or year: the period holding today, or the from date. Not with window
offsetMoves the period: -1 for the one before, [-3,-1] for the three before it
weekStartmonday (default, ISO 8601) or sunday; the project setting First day of the week for @UVWINDOW sets the default
notFuturetrue: the date may not be after today (a datetime: after now)
notPasttrue: the date may not be before today (a datetime: before now)
message, blockSave, when, caseSensitiveAs for the other tags
referencesNamed bindings that when reads as {alias}; needs event and instance references

Field types

Text fields with date, datetime or datetime-with-seconds validation, in any display format (Y-M-D, M-D-Y or D-M-Y). The from field must be the same kind: a date window counts from a date, a datetime window from a datetime. The message shows the allowed dates the way the field shows them.

What is checked, and when

Which day counts as today

A window counted from today or now, a period without from, and notPast are judged against the day the value was saved. The form judges only a value that is new or changed, so an old record never turns red because time has passed. After a save, and in the Validation scan, the module reads REDCap's own log for the day each value was saved; when the log does not show it, that part is reported as not checked. Use these rules for timeliness. Count a clinical window from a date in the record, such as the interview date: data entered late from paper, or synced late from the Mobile App, is saved days after the visit.

With event and instance references enabled in the project settings, from may name another event, e.g. [baseline_arm_1][visit_date]: the classic longitudinal visit window.

Audit

The post-save audit logs a violation as type: window with reason window-early, window-late, future or past, and the Validation scan reports it retrospectively. A part judged against today uses the day the value was saved, which the log entry names as as_of and the scan report as "Judged against <day>". A value whose save day REDCap's log does not show is reported as not checked, never judged against today.