Index: openacs-4/packages/calendar/www/cal-item-new.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-new.adp,v
diff -u -r1.26 -r1.26.2.1
--- openacs-4/packages/calendar/www/cal-item-new.adp	7 Aug 2017 23:48:05 -0000	1.26
+++ openacs-4/packages/calendar/www/cal-item-new.adp	27 Jan 2023 13:12:41 -0000	1.26.2.1
@@ -11,16 +11,12 @@
 
 <script type="text/javascript" <if @::__csp_nonce@ not nil> nonce="@::__csp_nonce;literal@"</if>>
     function disableTime(form_name) {
-          <multiple name="time_format_elms">
-            document.forms[form_name].elements["start_time.@time_format_elms.name@"].disabled = true;
-            document.forms[form_name].elements["end_time.@time_format_elms.name@"].disabled = true;
-          </multiple>
+            document.forms[form_name].elements["start_time"].disabled = true;
+            document.forms[form_name].elements["end_time"].disabled = true;
     }
     function enableTime(form_name) {
-          <multiple name="time_format_elms">
-            document.forms[form_name].elements["start_time.@time_format_elms.name@"].disabled = false;
-            document.forms[form_name].elements["end_time.@time_format_elms.name@"].disabled = false;
-          </multiple>
+            document.forms[form_name].elements["start_time"].disabled = false;
+            document.forms[form_name].elements["end_time"].disabled = false;
     }
 </script>
 
Index: openacs-4/packages/calendar/www/cal-item-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-new.tcl,v
diff -u -r1.41.2.13 -r1.41.2.14
--- openacs-4/packages/calendar/www/cal-item-new.tcl	24 Jan 2023 12:02:51 -0000	1.41.2.13
+++ openacs-4/packages/calendar/www/cal-item-new.tcl	27 Jan 2023 13:12:41 -0000	1.41.2.14
@@ -11,10 +11,10 @@
     cal_item_id:object_id,optional
     {item_type_id:object_id ""}
     {date:clock(%Y-%m-%d) ""}
-    {julian_date ""}
-    {start_time ""}
-    {end_time ""}
-    {view "day"}
+    {julian_date:clock(%J) ""}
+    {start_time:clock(%H:%M) ""}
+    {end_time:clock(%H:%M) ""}
+    {view:token "day"}
     {return_url:localurl "./"}
 }
 
@@ -24,6 +24,7 @@
 set user_id [ad_conn user_id]
 
 set date [calendar::adjust_date -date $date -julian_date $julian_date]
+
 set ansi_date $date
 set calendar_list [calendar::calendar_list]
 set calendar_options [calendar::calendar_list -privilege create]
@@ -59,23 +60,19 @@
         {maxlength 255}
         {html {size 45}}
     }
-    {date:date
+    {date:h5date
         {label "[_ calendar.Date_1]"}
-        {format "YYYY MM DD"}
-        {after_html {<input type="button" style="height:23px; width:23px; background: url('/resources/acs-templating/calendar.gif');" id='cal_item.date-button'> \[<b>[_ calendar.y-m-d]</b>\]} }
     }
     {time_p:text(radio)
         {label "&nbsp;"}
         {options {{"[_ calendar.All_Day_Event]" 0}
             {"[_ calendar.Use_Hours_Below]" 1} }}
     }
-    {start_time:date,optional
+    {start_time:h5time,optional
         {label "[_ calendar.Start_Time]"}
-        {format {[lc_get formbuilder_time_format]}}
     }
-    {end_time:date,optional
+    {end_time:h5time,optional
         {label "[_ calendar.End_Time]"}
-        {format {[lc_get formbuilder_time_format]}}
     }
     {location:text(text),optional
         {label "[_ calendar.Location]"}
@@ -134,31 +131,6 @@
 
 
 #----------------------------------------------------------------------
-# LARS: Hack to make enable/disable time widgets work with i18n
-#----------------------------------------------------------------------
-
-set format_string [lc_get formbuilder_time_format]
-
-multirow create time_format_elms name
-
-while { $format_string ne "" } {
-    # Snip off the next token
-    regexp {([^/\-.: ]*)([/\-.: ]*)(.*)} \
-        $format_string match word sep format_string
-    # Extract the trailing "t", if any
-    regexp -nocase $template::util::date::token_exp $word \
-        match token type
-
-    # Output the widget
-    set fragment_def $template::util::date::fragment_widgets([string toupper $token])
-
-    multirow append time_format_elms [lindex $fragment_def 1]
-}
-
-
-
-
-#----------------------------------------------------------------------
 # Finishing definition of form
 #----------------------------------------------------------------------
 
@@ -192,25 +164,13 @@
                              -package_id $package_id]
     }
 
-    set date [calendar::from_sql_datetime -sql_date $ansi_date  -format "YYY-MM-DD"]
     set repeat_p 0
-    if {[info exists start_time] &&
-        $start_time != 0 &&
-        [template::util::date::validate [list {} {} {} $start_time 0 {} {HH24:MI}] e]
-    } {
-        # Set the start time
-        set start_hour $start_time
-        set start_time "{} {} {} $start_time 0 {} {HH24:MI}"
-        set end_time "{} {} {} [expr {$start_hour + 1}] 0 {} {HH24:MI}"
-        set time_p 1
-    } else {
-        set time_p 0
-        set start_hour $start_time
-        set start_time "{} {} {} 0 0 {} {HH24:MI}"
-        set end_time "{} {} {} 0 0 {} {HH24:MI}"
-        set js "disableTime('cal_item');"
+
+    if {$start_time ne "" && $end_time eq ""} {
+        # Default end_time is one hour after start_time
+        set end_time [clock format [clock add [clock scan $start_time -format {%H:%M}] 1 hour] -format {%H:%M}]
     }
-    # set the calendar_id before setting item_types form element (see top of script) DAVEB
+
     set calendar_id [lindex $calendar_options 0 1]
 
 } -edit_request {
@@ -254,14 +214,18 @@
         element set_properties cal_item edit_what -widget hidden
         element set_value cal_item edit_what this
     }
-    set date       [calendar::from_sql_datetime -sql_date $ansi_start_date  -format "YYY-MM-DD"]
-    set start_time [template::util::date::from_ansi $ansi_start_date [lc_get formbuilder_time_format]]
-    set end_time   [template::util::date::from_ansi $ansi_end_date [lc_get formbuilder_time_format]]
 
+    set start_clock [clock scan $ansi_start_date -format {%Y-%m-%d %H:%M:%S}]
+    set end_clock   [clock scan $ansi_end_date -format {%Y-%m-%d %H:%M:%S}]
+
+    set date       [clock format $start_clock -format {%Y-%m-%d}]
+    set start_time [clock format $start_clock -format {%H:%M}]
+    set end_time   [clock format $end_clock   -format {%H:%M}]
+
 } -on_submit {
 
-    set start_date [calendar::to_sql_datetime -date $date -time $start_time -time_p $time_p]
-    set end_date   [calendar::to_sql_datetime -date $date -time $end_time -time_p $time_p]
+    set start_date "$date $start_time"
+    set end_date   "$date $end_time"
 
     if {![calendar::item::dates_valid_p -start_date $start_date -end_date $end_date]} {
          template::form::set_error cal_item start_time [_ calendar.start_time_before_end_time]
@@ -270,16 +234,9 @@
 
 } -new_data {
 
-    set formatted_date ""
-    append formatted_date \
-        [template::util::date::get_property year  $date] " " \
-        [template::util::date::get_property month $date] " " \
-        [template::util::date::get_property day   $date]
-    set date $formatted_date
+    set start_date "$date $start_time"
+    set end_date   "$date $end_time"
 
-    set start_date [calendar::to_sql_datetime -date $date -time $start_time -time_p $time_p]
-    set end_date   [calendar::to_sql_datetime -date $date -time $end_time -time_p $time_p]
-
     if { ![calendar::personal_p -calendar_id $calendar_id] } {
         permission::require_permission -object_id $calendar_id -privilege create
     }
@@ -304,25 +261,15 @@
 
 } -edit_data {
 
-    #
-    # Format date
-    #
-    set formatted_date ""
-    append formatted_date \
-        [template::util::date::get_property year  $date] " " \
-        [template::util::date::get_property month $date] " " \
-        [template::util::date::get_property day   $date]
-    set date $formatted_date
-
     # Require write permission on the item and create on the calendar into which we're putting it
     permission::require_write_permission -object_id $cal_item_id
     if { ![calendar::personal_p -calendar_id $calendar_id] } {
         permission::require_permission -object_id $calendar_id -privilege create
     }
 
     # set up the datetimes
-    set start_date [calendar::to_sql_datetime -date $date -time $start_time -time_p $time_p]
-    set end_date [calendar::to_sql_datetime -date $date -time $end_time -time_p $time_p]
+    set start_date "$date $start_time"
+    set end_date   "$date $end_time"
     set edit_all_p 0
     set edit_past_events_p 0
     if {[info exists edit_what]} {
@@ -370,7 +317,6 @@
 # Register JS Eventhandlers
 template::add_event_listener -id cal_item:elements:time_p:0 -preventdefault=false -script {TimePChanged(this);}
 template::add_event_listener -id cal_item:elements:time_p:1 -preventdefault=false -script {TimePChanged(this);}
-template::add_event_listener -id cal_item.date-button -script {showCalendarWithDateWidget('date', 'y-m-d');}
 
 template::add_body_script -script {
     if (document.forms["cal_item"].time_p[0].checked == true ) {