@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"}
| Key | Meaning |
|---|---|
from | The 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 |
unit | days (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 |
period | week, month, quarter or
year: the period holding today, or the from date. Not with
window |
offset | Moves the period: -1 for the one before,
[-3,-1] for the three before it |
weekStart | monday (default, ISO 8601) or
sunday; the project setting First day of the week for @UVWINDOW
sets the default |
notFuture | true: the date may not be after today
(a datetime: after now) |
notPast | true: the date may not be before today
(a datetime: before now) |
message, blockSave, when,
caseSensitive | As for the other tags |
references | Named 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
- A blank field, or a blank
fromdate, checks nothing: the visit that anchors the window may not have happened yet. - A date that is still being typed shows no verdict. REDCap's own date check covers that.
- Today is the server's date, never the computer's, so a laptop whose clock is a day ahead cannot accept tomorrow's date. A page left open across midnight moves to the next day. When the study's time zone differs from the server's, name it in the project setting Time zone for @UVWINDOW "notFuture". A date and time may run up to 120 seconds past the server's "now". On the page the margin also covers a computer clock that is off, up to 10 minutes, so REDCap's Now button passes there; after saving, the audit and the scan allow 12 minutes either side of the save.
- One time zone per project.
notFutureon a field filled by@NOW-UTC,@TODAY-UTC,@NOW-SERVERor@TODAY-SERVERis refused when that zone runs ahead of the rule's; a rule that also has a window keeps the window. Hour and minute windows count wall-clock time. notFuturedoes not need thefromdate: afromdate that cannot be read or resolved stops only the window part, which staff are told and the audit logs as not checked.- A
fromdate on another form is read when the page opens. That check is advisory: it shows the verdict but never blocks the save, because the other form could change while this one is open.notFuturekeeps itsblockSave, unless awhencondition reads a value from another form or event: then nothing in the rule blocks. - On a survey, or for a user without rights to that form, the
fromdate is not sent to the page. The page checks onlynotFuture, and the window is checked when the record is saved. On a multi-page survey, put thefromfield on the same page.
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.