rem: gDuration = end.subtractDate(start); 
add: gDuration = gEndDate.subtractDate(gStartDate); 
context: function updateEndTime() {    if (gIgnoreUpdate) {        return;    }    var startWidgetId = "event-starttime";    var endWidgetId = "event-endtime";    var startWidget = document.getElementById(startWidgetId);    var endWidget = document.getElementById(endWidgetId);    var saveStartTime = gStartDate;    var saveEndTime = gEndDate;    var kDefaultTimezone = calendarDefaultTimezone();    var start = jsDateToDateTime(startWidget.value);    start = start.getInTimezone(kDefaultTimezone);    if (gDisplayTimezone) {        start.timezone = gStartTimezone;    }    gStartDate = start;    var end = jsDateToDateTime(endWidget.value);    end = end.getInTimezone(kDefaultTimezone);    var timezone = gEndTimezone;    if (timezone == "UTC" &&        gStartDate &&        gStartTimezone != gEndTimezone) {        timezone = gStartTimezone;    }    if (gDisplayTimezone) {        end.timezone = timezone;    }    gEndDate = end;    var allDayElement = document.getElementById("all-day");    var allDay = allDayElement.getAttribute("checked") == "true";    if (allDay) {        gStartDate.isDate = true;        gEndDate.isDate = true;    }    // Calculate the new duration of start/end-time.    // don't allow for negative durations.    var warning = false;    if (gEndDate.compare(gStartDate) >= 0) {        gDuration = end.subtractDate(start);    } else {        gStartDate = saveStartTime;        gEndDate = saveEndTime;        warning = true;    }    propagateDateTime();    if (warning) {        var callback = function() {            var promptService =                Components.classes[                    "@mozilla.org/embedcomp/prompt-service;1"]                    .getService(                        Components.interfaces.nsIPromptService);            promptService.alert(                null,                document.title,                calGetString("calendar", "warningNegativeDuration"));        }        setTimeout(callback, 1);    }}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/9421/496852d95be0e5e92b5a8af0e798cf45ccd1608d/sun-calendar-event-dialog-attendees.js/buggy/calendar/prototypes/wcap/sun-calendar-event-dialog-attendees.js