try to find a good start time before opening the event dialog.

This commit is contained in:
pavlov%pavlov.net 2005-04-19 03:28:58 +00:00
parent 27f6e89169
commit 3aa35edeaf

View File

@ -36,6 +36,9 @@
* ***** END LICENSE BLOCK ***** */
/* this needs to be a pref/system thing/something.. wtf! */
var TIMEZONE = "/mozilla.org/20050126_1/America/Los_Angeles"
/* all params are optional */
function createEventWithDialog(calendar, startDate, endDate, summary)
{
@ -45,7 +48,24 @@ function createEventWithDialog(calendar, startDate, endDate, summary)
startDate = jsDateToDateTime(new Date());
startDate.second = 0;
startDate.normalize();
} else if (startDate.isDate) {
/* set the hour/minute of startDate to "right now"
if the day is the same */
var now = jsDateToDateTime(new Date()).getInTimezone(TIMEZONE).clone();
var nowDate = now.clone();
nowDate.isDate = true;
nowDate.normalize();
if (startDate.compare(nowDate) == 0) {
/* they're the same, so set now's seconds to 0,
normalize and change startDate to be now. */
now.second = 0;
now.normalize();
startDate = now;
}
}
event.startDate = startDate.clone();
if (!endDate) {