Index: widgets/misc/e-dateedit.c
===================================================================
--- widgets/misc/e-dateedit.c	(revision 34284)
+++ widgets/misc/e-dateedit.c	(working copy)
@@ -1146,6 +1146,11 @@
 	    && priv->upper_hour == upper_hour)
 		return;
 
+	/* accept only valid values */
+	if (lower_hour < 0 || lower_hour > 24 ||
+	    upper_hour < 0 || upper_hour > 24)
+		return;
+
 	priv->lower_hour = lower_hour;
 	priv->upper_hour = upper_hour;
 
@@ -1402,7 +1407,7 @@
 	GtkWidget *listitem, *label;
 	char buffer[40];
 	struct tm tmp_tm;
-	gint hour, min;
+	gint hours, hour, min;
 
 	priv = dedit->priv;
 
@@ -1417,16 +1422,15 @@
 	tmp_tm.tm_sec  = 0;
 	tmp_tm.tm_isdst = 0;
 
-	for (hour = priv->lower_hour; hour <= priv->upper_hour; hour++) {
+	for (hours = 0, hour = priv->lower_hour; hours < 24; hour++, hours++) {
 
-		/* We don't want to display midnight at the end, since that is
-		   really in the next day. */
+		/* We will overlap to have all hours. */
 		if (hour == 24)
-			break;
+			hour = 0;
 
 		/* We want to finish on upper_hour, with min == 0. */
 		for (min = 0;
-		     min == 0 || (min < 60 && hour != priv->upper_hour);
+		     min == 0 || (min < 60 && (hour != priv->upper_hour || priv->upper_hour == priv->lower_hour));
 		     min += 30) {
 			tmp_tm.tm_hour = hour;
 			tmp_tm.tm_min  = min;
@@ -1454,6 +1458,10 @@
 			gtk_widget_show_all (listitem);
 			gtk_container_add (GTK_CONTAINER (list), listitem);
 		}
+
+		/* if lower_hour == upper_hour, then fill whole day */
+		if (hours > 0 && hour == priv->upper_hour)
+			break;
 	}
 }
 
Index: widgets/misc/ChangeLog
===================================================================
--- widgets/misc/ChangeLog	(revision 34284)
+++ widgets/misc/ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2007-09-18  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #231166
+
+	* e-dateedit.c: (e_date_edit_set_time_popup_range): Validity check.
+	* e-dateedit.c: (rebuild_time_popup): Allow time range to overlap
+	and can have lower_time greater than upper_time.
+
 2007-09-12  Matthew Barnes  <mbarnes@redhat.com>
 
 	** Fixes part of bug #476040
Index: calendar/gui/dialogs/cal-prefs-dialog.c
===================================================================
--- calendar/gui/dialogs/cal-prefs-dialog.c	(revision 34284)
+++ calendar/gui/dialogs/cal-prefs-dialog.c	(working copy)
@@ -721,7 +721,8 @@
 
 	gtk_widget_show (GTK_WIDGET (dedit));
 	e_date_edit_set_use_24_hour_format (E_DATE_EDIT (dedit), calendar_config_get_24_hour_format ());
-	e_date_edit_set_time_popup_range (E_DATE_EDIT (dedit), 0, 24);
+	e_date_edit_set_time_popup_range (E_DATE_EDIT (dedit), calendar_config_get_day_start_hour (), calendar_config_get_day_start_hour ());
+
 	e_date_edit_set_show_date (E_DATE_EDIT (dedit), FALSE);
 
 	return dedit;
Index: calendar/gui/dialogs/comp-editor-util.c
===================================================================
--- calendar/gui/dialogs/comp-editor-util.c	(revision 34284)
+++ calendar/gui/dialogs/comp-editor-util.c	(working copy)
@@ -239,7 +239,7 @@
 #else
 	e_date_edit_set_make_time_insensitive (dedit, FALSE);
 #endif
-	
+	e_date_edit_set_time_popup_range (dedit, calendar_config_get_day_start_hour (), calendar_config_get_day_start_hour ());
 	config = e_date_edit_config_new (dedit);
 	g_signal_connect (G_OBJECT (dedit), "destroy", G_CALLBACK (date_edit_destroy_cb), config);
 	
Index: calendar/gui/e-meeting-time-sel.c
===================================================================
--- calendar/gui/e-meeting-time-sel.c	(revision 34284)
+++ calendar/gui/e-meeting-time-sel.c	(working copy)
@@ -2287,8 +2287,8 @@
 		low_hour = mts->day_start_hour;
 		high_hour = mts->day_end_hour;
 	} else {
-		low_hour = 0;
-		high_hour = 23;
+		low_hour = mts->day_start_hour;
+		high_hour = mts->day_start_hour;
 	}
 
 	e_date_edit_set_time_popup_range (start_edit, low_hour, high_hour);
Index: calendar/ChangeLog
===================================================================
--- calendar/ChangeLog	(revision 34284)
+++ calendar/ChangeLog	(working copy)
@@ -1,3 +1,14 @@
+2007-09-18  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #231166
+
+	* gui/dialogs/cal-prefs-dialog.c: (cal_prefs_dialog_create_time_edit):
+	* gui/dialogs/comp-editor-util.c: (comp_editor_new_date_edit):
+	Sets time range beginning by configured day_start_hour.
+	* gui/e-meeting-time-sel.c:
+	(e_meeting_time_selector_update_date_popup_menus):
+	Always start with day_start_hour in a time picker.
+
 2007-09-14  Matthew Barnes  <mbarnes@redhat.com>
 
 	** Fixes part of bug #476231
