template::data::transform::date (public)

 template::data::transform::date element_ref

Defined in packages/acs-templating/tcl/date-procs.tcl

Collect a Date object from the form.

Parameters:
element_ref

Partial Call Graph (max 5 caller/called nodes):
%3 template::data::transform::time_of_day template::data::transform::time_of_day (public) template::data::transform::date template::data::transform::date template::data::transform::time_of_day->template::data::transform::date template::data::transform::timestamp template::data::transform::timestamp (public) template::data::transform::timestamp->template::data::transform::date template::util::date::create template::util::date::create (public) template::data::transform::date->template::util::date::create template::util::date::set_property template::util::date::set_property (public) template::data::transform::date->template::util::date::set_property

Testcases:
No testcase defined.
Source code:
    upvar $element_ref element
    set element_id $element(id)

    set the_date [template::util::date::create  {} {} {} {} {} {} [ns_queryget "$element_id.format"]]
    set have_values 0

    foreach field {
        year
        short_year
        month day
        short_hours
        hours
        minutes
        seconds
        ampm
    } {
        set key "$element_id.$field"
        if { [ns_queryexists $key] } {
            set value [ns_queryget $key]
            # Coerce values to nonnegative integers
            if { $field ne "ampm" } {
                if { ![regexp {[0-9]+} $value value] } {
                    set value {}
                }
            }
            # If the value is not null, set it
            if { $value ne {} } {
                set the_date [template::util::date::set_property $field $the_date $value]
                if { $field ne "ampm" } {
                    set have_values 1
                }
            }
        }
    }

    if { $have_values } {
        return [list $the_date]
    } else {
        return {}
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: