Commit 6d131896 authored by Frank Bergmann's avatar Frank Bergmann

- Changed handling of time zones:

  - Now all dates in the Gantt Editor and in other places are
    relative to the server timezone
  - The server doesn't send any time zone information to the
    JavaScript client anymore.
  - The JavaScript client doesn't send any time zone information
    to the server anymore.
  As a result, a task that starts at 9:00 am when created
  by a computer in Europe will also start at 9:00 when viewed
  from a US computer
parent ac0364be
......@@ -430,7 +430,6 @@ Ext.define('GanttEditor.controller.GanttSchedulingController', {
// Write the newEndDate into model
var newEndDate = new Date(newEndTime);
var newEndDateString = PO.Utilities.dateToPg(newEndDate);
newEndDateString = newEndDateString.substring(0,19);
if (me.debug) console.log('PO.controller.gantt_editor.GanttSchedulingController.checkTaskLength: end_date='+newEndDateString);
model.set('end_date', newEndDateString);
......@@ -489,32 +488,6 @@ Ext.define('GanttEditor.controller.GanttSchedulingController', {
if (me.debug) console.log('PO.controller.gantt_editor.GanttSchedulingController.checkAssignedResources: Finished');
},
/**
* Make sure endDate is after startDate
*/
checkStartEndDateConstraint: function(treeStore, model) {
var me = this;
if (me.debug) console.log('PO.controller.gantt_editor.GanttSchedulingController.checkStartEndDateConstraint: Starting');
var startDate = PO.Utilities.pgToDate(model.get('start_date'));
var endDate = PO.Utilities.pgToDate(model.get('end_date'));
if (startDate && endDate) {
var startTime = startDate.getTime();
var endTime = endDate.getTime();
if (startTime > endTime) {
// The user has entered inconsistent start/end dates
endTime = startTime + 1000 * 3600 * 24;
endDate = new Date(endTime);
endDateString = endDate.toISOString().substring(0,10);
if (me.debug) console.log('PO.controller.gantt_editor.GanttSchedulingController.checkStartEndDateConstraint: end_date=' + endDateString + ' - making sure end_date is after startDate');
model.set('end_date', endDateString);
}
}
if (me.debug) console.log('PO.controller.gantt_editor.GanttSchedulingController.checkStartEndDateConstraint: Finished');
},
/**
* Finds a node in a tree by a custom function.
......@@ -911,7 +884,6 @@ Ext.define('GanttEditor.controller.GanttSchedulingController', {
// Write the newEndDate into model
var newEndDate = new Date(newEndTime);
var newEndDateString = PO.Utilities.dateToPg(newEndDate);
newEndDateString = newEndDateString.substring(0,19);
if (me.debug) console.log('PO.controller.gantt_editor.GanttSchedulingController.scheduleTaskDuration: end_date='+newEndDateString);
model.set('end_date', newEndDateString);
......
......@@ -272,8 +272,12 @@ Ext.define('GanttEditor.controller.GanttTreePanelController', {
r.set('uom_id', ""+default_uom_id);
r.set('project_name', 'New Task');
r.set('work', ""+8); // 8 hours by default
r.set('start_date', new Date().toISOString().substring(0,10)+" 00:00:00"); // Indicates start of the day at 00:00:00
r.set('end_date', new Date().toISOString().substring(0,10)+" 23:59:59"); // Same as start_date, but indicates 23:59:59
var nowDate = PO.Utilities.dateToPg(new Date()).substring(0,10);
r.set('start_date', nowDate+" 00:00:00"); // Indicates start of the day at 00:00:00
r.set('end_date', nowDate+" 23:59:59"); // Same as start_date, but indicates 23:59:59
r.set('effort_driven_type_id', ""+default_effort_driven_type_id);
// Get a server-side object_id for the task
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment