- Publicity: Public Only All
date-procs.tcl
Date widgets for the ArsDigita Templating System
- Location:
- packages/acs-templating/tcl/date-procs.tcl
- Author:
- Stanislav Freidin <sfreidin@arsdigita.com>
- CVS Identification:
$Id: date-procs.tcl,v 1.63.2.24 2024/01/25 12:25:51 antoniop Exp $
Procedures in this file
- template::data::from_sql::date (public)
- template::data::from_sql::time_of_day (public)
- template::data::from_sql::timestamp (public)
- template::data::to_sql::date (public)
- template::data::to_sql::time_of_day (public)
- template::data::to_sql::timestamp (public)
- template::data::transform::date (public)
- template::data::transform::textdate (public)
- template::data::transform::time_of_day (public)
- template::data::transform::timestamp (public)
- template::data::validate::h5date (public)
- template::data::validate::h5time (public)
- template::util::date (public)
- template::util::date::acquire (public)
- template::util::date::add_time (public)
- template::util::date::compare (public)
- template::util::date::create (public)
- template::util::date::daysInMonth (public)
- template::util::date::defaultInterval (public)
- template::util::date::from_ansi (public)
- template::util::date::get_property (public)
- template::util::date::init (public)
- template::util::date::monthName (public)
- template::util::date::now (public)
- template::util::date::now_min_interval (public)
- template::util::date::now_min_interval_plus_hour (public, deprecated)
- template::util::date::set_property (public)
- template::util::date::today (public)
- template::util::date::unpack (public)
- template::util::date::validate (public)
- template::util::leadingPad (public, deprecated)
- template::util::leadingTrim (public, deprecated)
- template::util::negative (public)
- template::util::textdate (public)
- template::util::textdate::create (public)
- template::util::textdate_localized_format (public)
- template::util::time_of_day::get_property (public)
- template::util::time_of_day::set_property (public)
- template::util::timestamp::get_property (public)
- template::util::timestamp::set_property (public)
- template::widget::ampmFragment (public)
- template::widget::date (public)
- template::widget::dateFragment (public)
- template::widget::h5date (public)
- template::widget::h5time (public)
- template::widget::monthFragment (public)
- template::widget::numericRange (public)
- template::widget::numericrange (public)
- template::widget::textdate (public)
- template::widget::time_of_day (public)
- template::widget::timestamp (public)
Detailed information
template::data::from_sql::date (public)
template::data::from_sql::date value
Reads an ANSI date as a templating date object.
- Parameters:
- value
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- template_date_api
template::data::from_sql::time_of_day (public)
template::data::from_sql::time_of_day value
Reads an ANSI time of day as a templating date object.
- Parameters:
- value
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- template_date_api
template::data::from_sql::timestamp (public)
template::data::from_sql::timestamp value
Reads an ANSI timestamp as a templating date object.
- Parameters:
- value
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- template_date_api
template::data::to_sql::date (public)
template::data::to_sql::date value
Converts a templating date object into a SQL date.
- Parameters:
- value
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- template_date_api
template::data::to_sql::time_of_day (public)
template::data::to_sql::time_of_day value
Converts a templating date object into a SQL time.
- Parameters:
- value
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- template_date_api
template::data::to_sql::timestamp (public)
template::data::to_sql::timestamp value
Converts a templating date object into a SQL timestamp.
- Parameters:
- value
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- template_date_api
template::data::transform::date (public)
template::data::transform::date element_ref
Collect a Date object from the form.
- Parameters:
- element_ref
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::data::transform::textdate (public)
template::data::transform::textdate element_ref
Collect a textdate from the form, it automatically reformats it from the users locale to the ISO standard YYYY-MM-DD this is useful because it doesn't need reformatting in Tcl code.
- Parameters:
- element_ref
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::data::transform::time_of_day (public)
template::data::transform::time_of_day element_ref
Collect a time_of_day object from the form.
- Parameters:
- element_ref
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::data::transform::timestamp (public)
template::data::transform::timestamp element_ref
Collect a timestamp object from the form.
- Parameters:
- element_ref
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::data::validate::h5date (public)
template::data::validate::h5date value_ref message_ref
Validate a date submitted via HTML 5 input type "date". The submitted value is also checked against any "min" and "max" constraint set on the input element itself.
- Parameters:
- value_ref - Reference variable to the submitted value.
message_ref - Reference variable for returning an error message.
- Returns:
- True (1) if valid, false (0) if not.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::data::validate::h5time (public)
template::data::validate::h5time value_ref message_ref
Validate that a date submitted via HTML 5 input type "time". The sbumitted value is also checked against any set "min" and "max" constraint set on the input element itself.
- Parameters:
- value_ref - Reference variable to the submitted value.
message_ref - Reference variable for returning an error message.
- Returns:
- True (1) if valid, false (0) if not.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::date (public)
template::util::date command [ args... ]
Dispatch procedure for the date object
- Parameters:
- command
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::date::acquire (public)
template::util::date::acquire type [ value ]
Create a new date with some predefined value. Basically, create and set the date.
- Parameters:
- type
value (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- template_date_api
template::util::date::add_time (public)
template::util::date::add_time -time_array_name time_array_name \ -date_array_name date_array_name
Set the time and date and new format properties into one date object (list) which is returned. Not sure this proc should live here...
- Switches:
- -time_array_name
(required)- -date_array_name
(required)- Author:
- Walter McGinnis <wtem@olywa.net>
- Created:
- 2002-01-04
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::date::compare (public)
template::util::date::compare date1 date2
Perform date comparison; same syntax as string compare.
- Parameters:
- date1
date2
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::date::create (public)
template::util::date::create [ year ] [ month ] [ day ] [ hours ] \ [ minutes ] [ seconds ] [ format ]
Create a new Date object. This is defined as a list of 7 elements, respectively representing year, month, day, hours, minutes, seconds and format.
- Parameters:
- year (optional)
month (optional)
day (optional)
hours (optional)
minutes (optional)
seconds (optional)
format (defaults to"DD MONTH YYYY"
)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- template_date_api
template::util::date::daysInMonth (public)
template::util::date::daysInMonth month [ year ]
- Parameters:
- month
year (defaults to"0"
) - an integer representing the number of the year in the Gregorian calendar.
- Returns:
- the number of days in a month, accounting for leap years.
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::date::defaultInterval (public)
template::util::date::defaultInterval what
Get the default ranges for all the numeric fields of a Date object
- Parameters:
- what
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::date::from_ansi (public)
template::util::date::from_ansi ansi_date [ format ]
Create a new templating system date structure from a full ANSI date, i.e. in the format YYYY-MM-DD HH24:MI:SS.
- Parameters:
- ansi_date - Date in full ANSI format YYYY-MM-DD HH24:MI:SS (time portion is optional).
format (defaults to"YYYY MM DD"
) - Format for the date object. Optional, defaults to YYYY MM DD.
- Returns:
- Date object for use with e.g. form builder.
- Author:
- Lars Pind <lars@pinds.com>
- Created:
- November 18, 2002
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::date::get_property (public)
template::util::date::get_property what date
Returns a property of a date list, usually created by ad_form.
- Parameters:
- what - the name of the property. One of:
- year
- month
- day
- hours
- minutes
- seconds
- format
- long_month_name
- short_month_name
- days_in_month
- short_year
- short_hours
- ampm
- not_null
- sql_date
- linear_date
- linear_date_no_time
- display_date
- clock
date - the date widget list
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- sql_date, template_date_api
template::util::date::init (public)
template::util::date::init
Sets up some initial variables and other conditions to facilitate the data structure template::util::date working properly and completely.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::date::monthName (public)
template::util::date::monthName month length
Return the specified month name (short or long)
- Parameters:
- month
length
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::date::now (public)
template::util::date::now
Create a new Date object for the current date and time.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- sql_date
template::util::date::now_min_interval (public)
template::util::date::now_min_interval [ -clock clock ]
Create a new Date object for the current date and time with the default interval for minutes
- Switches:
- -clock
(optional)- time in seconds, if not specified, it uses current time
- Author:
- Walter McGinnis <wtem@olywa.net>
- Created:
- 2002-01-06
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- date_minute_interval
template::util::date::now_min_interval_plus_hour (public, deprecated)
template::util::date::now_min_interval_plus_hour [ -clock clock ]
Deprecated. Invoking this procedure generates a warning.
Create a new Date object for the current date and time plus one hour with the default interval for minutes.
- Switches:
- -clock
(optional)- time in seconds, if not specified, it uses current time Deprecated: as of 2019-04-25, no upstream code is making use of this proc and more generic alternatives exist.
- Author:
- Walter McGinnis <wtem@olywa.net>
- Created:
- 2002-01-06
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::date::set_property (public)
template::util::date::set_property what date value
Replace a property in a list created by a date widget.
- Parameters:
- what - name of the property (see source for allowed values)
date - the date list
value - the new value
- Returns:
- the modified list
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- template_date_api
template::util::date::today (public)
template::util::date::today
Create a new Date object for the current date.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::date::unpack (public)
template::util::date::unpack date
Set the variables for each field of the date object in the calling frame. sets: year month day hours minutes seconds format from a list formatted date string
- Parameters:
- date
- See Also:
- template::util::date::from_ans
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- template_date_api
template::util::date::validate (public)
template::util::date::validate date error_ref
Validate a date object.
- Parameters:
- date
error_ref
- Returns:
- 1 if the object is valid, 0 otherwise. Set the error_ref variable to contain an error message, if any.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- validate_date
template::util::leadingPad (public, deprecated)
template::util::leadingPad string size
Deprecated. Invoking this procedure generates a warning.
Pad a string with leading zeros Deprecated: please use the new and more general 'ad_pad'.
- Parameters:
- string
size
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::leadingTrim (public, deprecated)
template::util::leadingTrim value
Deprecated. Invoking this procedure generates a warning.
Trim the leading zeros from the value, but preserve the value as "0" if it is "00"
- Parameters:
- value
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::negative (public)
template::util::negative value
Check if a value is less than zero, but return false if the value is an empty string.
- Parameters:
- value
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- util_negative
template::util::textdate (public)
template::util::textdate command [ args... ]
Dispatch procedure for the textdate object
- Parameters:
- command
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::textdate::create (public)
template::util::textdate::create [ textdate ]
Build a textdate datatype structure, which is just the string itself for this simple type.
- Parameters:
- textdate (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::textdate_localized_format (public)
template::util::textdate_localized_format
Gets the localized format for the textdate widget
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::time_of_day::get_property (public)
template::util::time_of_day::get_property what date
Replace a property in a list created by a time_of_day widget. It's the same as the date one. This is needed by the form builder to support explicit to_sql element modifiers.
- Parameters:
- what
date
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::time_of_day::set_property (public)
template::util::time_of_day::set_property what date value
Get a property in a list created by a time_of_day widget. It's the same as the date one. This is needed by the form builder to support explicit from_sql element modifiers.
- Parameters:
- what
date
value
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::timestamp::get_property (public)
template::util::timestamp::get_property what date
Replace a property in a list created by a timestamp widget. It's the same as the date one. This is needed by the form builder to support explicit to_sql element modifiers.
- Parameters:
- what
date
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::util::timestamp::set_property (public)
template::util::timestamp::set_property what date value
Get a property in a list created by a timestamp widget. It's the same as the date one. This is needed by the form builder to support explicit from_sql element modifiers.
- Parameters:
- what
date
value
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::widget::ampmFragment (public)
template::widget::ampmFragment element_reference fragment size type \ value [ mode ] [ tag_attributes ]
Create a widget that shows the am/pm selection
- Parameters:
- element_reference
fragment
size
type
value
mode (defaults to"edit"
)
tag_attributes (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::widget::date (public)
template::widget::date element_reference tag_attributes
Create a date entry widget according to a format string The format string should contain the following fields, separated by / \ - : . or whitespace:
Any format field may be followed by "t", in which case a text widget will be used to represent the field. the array in range_ref determines interval ranges; the keys are the date fields and the values are in form {start stop interval}
string meaning YYYY 4-digit year YY 2-digit year MM 2-digit month MON month name, short (i.e. "Jan") MONTH month name, long (i.e. "January") DD day of month HH12 12-hour hour HH24 24-hour hour MI minutes SS seconds AM am/pm flag
- Parameters:
- element_reference
tag_attributes
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::widget::dateFragment (public)
template::widget::dateFragment element_reference fragment size type \ value [ mode ] [ tag_attributes ]
Create an input widget for the given date fragment If type is "t", uses a text widget for the fragment, with the given size. Otherwise, determines the proper widget based on the element flags, which may be text or a picklist.
- Parameters:
- element_reference
fragment
size
type
value
mode (defaults to"edit"
)
tag_attributes (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::widget::h5date (public)
template::widget::h5date element_reference tag_attributes
Implements the HTML 5 input type "date". Supported element parameters: "-min" and "-max": for setting minimum and maximum dates that can be chosen by the user. If used, the condition min <= value <= max must be met. (Format = YYYY-MM-DD) "-step": number of days jumped each time the date is incremented. Value must be an integer Parameters supplied this way will supersede same-named parameters supplied through the "-html" switch. This widget also adds the attribute "pattern" as fallback for browsers which do not support input type="date".
- Parameters:
- element_reference
tag_attributes
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::widget::h5time (public)
template::widget::h5time element_reference tag_attributes
Implements the HTML 5 input type "time". Supported element parameters: "-min" and "-max": for setting minimum and maximum times that can be chosen by the user. If used, the condition min <= value <= max must be met. (Format = "hh:mm" or "hh:mm:ss" if parameter "-step" is present) "-step": integer value that equates to the number of seconds you want to increment by Parameters supplied this way will supersede same-named parameters supplied through the "-html" switch. This widget also adds the attribute "pattern" as fallback for browsers which do not support input type="time".
- Parameters:
- element_reference
tag_attributes
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::widget::monthFragment (public)
template::widget::monthFragment element_reference fragment size type \ value [ mode ] [ tag_attributes ]
Create a month entry widget with short or long month names.
- Parameters:
- element_reference
fragment
size
type
value
mode (defaults to"edit"
)
tag_attributes (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::widget::numericRange (public)
template::widget::numericRange name interval_def size [ value ] \ [ tag_attributes ]
Create an HTML fragment to display a numeric range widget interval_def is in form { start stop interval }
- Parameters:
- name
interval_def
size
value (optional)
tag_attributes (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::widget::numericrange (public)
template::widget::numericrange element_reference tag_attributes
Widget proc usable with ad_form to display a numeric range widget. Need to define interval_def as {interval_def {start end step}}
- Parameters:
- element_reference
tag_attributes
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::widget::textdate (public)
template::widget::textdate element_reference tag_attributes
Implements the textdate widget.
- Parameters:
- element_reference
tag_attributes
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::widget::time_of_day (public)
template::widget::time_of_day element_reference tag_attributes
Render a time_of_day widget. Default is the localized version.
- Parameters:
- element_reference
tag_attributes
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
template::widget::timestamp (public)
template::widget::timestamp element_reference tag_attributes
Render a timestamp widget. Default is the localized version.
- Parameters:
- element_reference
tag_attributes
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.