What is the correct way to create a date time widget and setting and getting its contents?
Right now I'm using:
template::element create new_meeting meetingdate \
-widget date \
-label "Date" \
-datatype date \
-format {YYYY-MM-DD HH24:MI} \
-value [calendar::from_sql_datetime -sql_date "$meetingdate" -format {YYYY-MM-DD HH24:MI}]
and:
set meetingdate [calendar_make_datetime $meetingdate]
and added this code to:
calendar/tcl/calendar-2-procs.tcl
{YYYY-MM-DD HH24:MI} {
regexp {([0-9]*)-([0-9]*)-([0-9]*).([0-9]*):([0-9]*)} $sql_date all year month day hours minutes
set date [template::util::date::set_property format $date {YYYY-MM-DD HH24:MI}]
set date [template::util::date::set_property year $date $year]
set date [template::util::date::set_property month $date $month]
set date [template::util::date::set_property day $date $day]
set date [template::util::date::set_property hours $date $hours]
set date [template::util::date::set_property minutes $date $minutes]
}
but it fails with this error:
Request Error
can't read "year": no such variable
while executing
"template::util::date::set_property year $date $year"
("YYYY-MM-DD HH24:MI" arm line 5)
invoked from within
"switch -exact -- $format {
{YYYY-MM-DD HH24:MI} {
regexp {([0-9]*)-([0-9]*)-([0-9]*).([0-9]*):([0-9]*)} $sql_date all year..."
(procedure "calendar::from_sql_datetime" line 7)
invoked from within
"calendar::from_sql_datetime -sql_date "$meetingdate" -format {YYYY-MM-DD HH24:MI}"
invoked from within
"template::element create new_meeting meetingdate -widget date -label "Date" -datatype date -format {YYYY-MM-DD HH24:MI} -value [calendar::from_sq..."
("uplevel" body line 48)
invoked from within
"uplevel {
# packages/meetings/www/add-edit.tcl