date

Description

Wpart responsible for handling the dates. Since it is the most convenient format, dates inside the Erlang Virtual Machine are kept as the {Year, Month, Day} tuples. wpart_date does the actual formatting and conversions.

The rendered widget is <input type="text" ... />

Validation

option

format

description

error message

format

"Format"

Defines the format of the date

{bad_date_format, Input} or {bad_separator_in_date_form, Input}

min

{H, M, S} where H, M and S are integers

Sets the lower bound of the entered date

{bad_range, Input}

max

{H, M, S} where H, M and S are integers

Sets the upper bound of the entered date

{bad_range, Input}

HTML meta-attributes

name

format

description

format

"Format"

Describes the format date should be displayed with. The available formats are listed below. The default format is YYYY-MM-DD.

Formats

format

description

example (for a tuple: {1999, 10, 4}

YYYY

year in four digit format

1999

YY

year in two digit format

99

MM

month in two digit format

10

SMONTH

month in a short word format

Oct

MONTH

month in a word format

October

DD

day in two digit format

04

SDAY

day of the week in a short word format

Mon

DAY

day of the week in a word format

Monday

Other character

passed through

Other character

Formatting examples

format

input

result

YYYY-MM-DD

{2001, 01, 01}

"2001-01-01"

DAY, SMONTH, YY

{1980, 04, 20}

"Sunday, Apr, 80"

Examples

Records definitions

...
{date, [{format, "YY:MM:DD"},
        {min, {1986, 11, 7}},
         %% other parameters
       ]
},
...

HTML tag

<wpart:date format="MM SDAY, YYYY" OTHER_HTML_ATTRIBUTES />

Wparts/BasicTypes/date (last edited 2009-02-13 11:41:20 by Michal Ptaszek)