future — date is a future date


Verification of the form field value succeeds if the passed time and date are in the future, compared to the current time.

It is possible to specify a minimum accepted time difference between the current and passed date. The specification can be any valid interval.


Example: Check for future date


Example: Check for future date, displaying a custom error message

FORM_FIELD_NAME=future "Date must be in the future"

Example: Check for future date, at least 2 days ahead

FORM_FIELD_NAME=future 2 days "Date must be at least two days ahead"

Example: Check for date within 60 minutes behind the current time

FORM_FIELD_NAME=future -60 minutes "Time must be within an hour behind"


This order check makes sense with date fields and widgets only.

The time difference can be specified as a negative value as well, effectively allowing you to check whether the passed date is "too behind" the current date.


future is available in Interchange versions:

4.6.0-5.9.0 (git-head)


Interchange 5.9.0:

Source: code/OrderCheck/future.oc
Lines: 50

# Copyright 2005-2007 Interchange Development Group and others
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.  See the LICENSE file for details.
# $Id: future.oc,v 1.5 2007-03-30 23:40:48 pajamian Exp $

CodeDef future OrderCheck 1
CodeDef future Description Future date
CodeDef future Routine <<EOR
sub {
my($ref, $name, $value, $code) = @_;
my $message;

my @code = Text::ParseWords::shellwords($code);
if($code =~ /(["']).+?\1$/) {
  $message = pop(@code);
my $adjust = join " ", @code;
if(! $message) {
  $message = errmsg(
            "Date must be in the future at least %s",
if($value =~ /\0/) {
  $value = Vend::Interpolate::filter_value(
my $current = Vend::Interpolate::mvtime(
                    { adjust => $adjust },

# reject invalid dates
if($value !~ /^[12]\d\d\d[01]\d[0123]\d(?:[0-2]\d[0-5]\d(?:[0-5]\d)?)?$/) {
  return (0, $name, $message);

if($value lt $current) {
  return (0, $name, $message);
return (1, $name, '');


Interchange Development Group


DocBook! Interchange!