Checked in attachment 147722 for bug 232320

This commit is contained in:
mostafah%oeone.com 2004-05-05 15:28:02 +00:00
Родитель 01a2ee9caa
Коммит d31c7d4cba
2 изменённых файлов: 43 добавлений и 29 удалений

Просмотреть файл

@ -137,7 +137,12 @@ function loadCalendarEventDialog()
document.getElementById( "start-datetime" ).value = gStartDate;
gEndDate.setTime( gEvent.end.getTime() );
document.getElementById( "end-datetime" ).value = gEndDate;
var userEndDate = new Date(gEndDate);
if( gEvent.allDay ) {
//userland enddate == ical enddate - 1, in the case of allday events
userEndDate.setDate( userEndDate.getDate() - 1 );
}
document.getElementById( "end-datetime" ).value = userEndDate;
gDuration = gEndDate.getTime() - gStartDate.getTime(); //in ms
@ -497,19 +502,20 @@ function checkEndTime()
function checkEndDate()
{
var startDate = document.getElementById( "start-datetime" ).value;
var endDate = document.getElementById( "end-datetime" ).value;
if( startDate.getFullYear() == endDate.getFullYear() &&
startDate.getMonth() == endDate.getMonth() &&
startDate.getDay() == endDate.getDay() )
if( gStartDate.getFullYear() == gEndDate.getFullYear() &&
gStartDate.getMonth() == gEndDate.getMonth() &&
gStartDate.getDay() == gEndDate.getDay() ) {
if( getFieldValue( "all-day-event-checkbox", "checked" ) ) {
return( -1 ) //from users point of view allday events end at gEndDate-1
} else {
return( 0 );
else if ( endDate < startDate)
}
} else if ( gEndDate < gStartDate) {
return -1;
else if (endDate > startDate)
} else if ( gEndDate > gStartDate) {
return 1;
}
}
function checkSetTimeDate()
{
@ -549,17 +555,15 @@ function checkSetRecurTime()
{
var recurEndDate = document.getElementById( "repeat-end-date-picker" ).value;
var endDate = document.getElementById( "end-datetime" ).value;
var recurForever = getFieldValue( "repeat-forever-radio", "selected" );
var recur = getFieldValue( "repeat-checkbox", "checked" );
debug(recurForever+ " and "+ recur+ "\n");
var state = ( recurEndDate.getTime() < endDate.getTime() &&
( recurEndDate.getFullYear() != endDate.getFullYear() ||
recurEndDate.getMonth() != endDate.getMonth() ||
recurEndDate.getDate() != endDate.getDate() )
var state = ( recurEndDate.getTime() < gEndDate.getTime() &&
( recurEndDate.getFullYear() != gEndDate.getFullYear() ||
recurEndDate.getMonth() != gEndDate.getMonth() ||
recurEndDate.getDate() != gEndDate.getDate() )
&& !recurForever && recur) ;
setRecurError(state);
return(!state );
@ -607,6 +611,10 @@ function onDateTimePick( dateTimePicker )
if( dateTimePicker.id == "end-datetime" )
{
if( getFieldValue( "all-day-event-checkbox", "checked" ) ) {
//user enddate == ical enddate - 1 (for allday events)
pickedDateTime.setDate( pickedDateTime.getDate() + 1 );
}
gEndDate = pickedDateTime;
// save the duration
gDuration = gEndDate.getTime() - gStartDate.getTime();
@ -621,7 +629,12 @@ function onDateTimePick( dateTimePicker )
// preserve the previous duration by changing end
gEndDate.setTime( gStartDate.getTime() + gDuration );
document.getElementById( "end-datetime" ).value = gEndDate;
var userEndDate =new Date(gEndDate)
if( getFieldValue( "all-day-event-checkbox", "checked" ) ) {
//user enddate == ical enddate - 1 (for allday events)
userEndDate.setDate( userEndDate.getDate() - 1 );
}
document.getElementById( "end-datetime" ).value = userEndDate;
}
var now = new Date();

Просмотреть файл

@ -547,14 +547,14 @@ var treeView =
var eventLength = calendarEvent.end.getTime() - calendarEvent.start.getTime();
var actualEndDate = eventEndDate.getTime() + eventLength;
eventEndDate = new Date( actualEndDate );
if( calendarEvent.allDay ) {
//user-enddate is ical-enddate - 1
eventEndDate.setDate( eventEndDate.getDate() - 1 );
var endDate = formatUnifinderEventDate( eventEndDate );
return(gCalendarBundle.getFormattedString("unifinderAlldayEventDate", [endDate]));
} else {
var endTime = formatUnifinderEventTime( eventEndDate );
var endDate = formatUnifinderEventDate( eventEndDate );
if( calendarEvent.allDay )
{
return(gCalendarBundle.getFormattedString("unifinderAlldayEventDate", [endDate]));
}
else
{
return(gCalendarBundle.getFormattedString("unifinderNormalEventDate", [endDate, endTime]));
}
@ -784,6 +784,7 @@ function getPreviewText( calendarEvent )
HolderBox.appendChild( DateHtml );
DateHtml = document.createElement( "description" );
endDate.setDate( endDate.getDate() - 1 ); //allday enddate for user
textString = gCalendarBundle.getFormattedString("tooltipEventEnd",
[gCalendarWindow.dateFormater.getFormatedDate( endDate ),
""]);