Commit 1d7c3a743cedc9eb75fdafe30bd12209e3f8fabe

Authored by Hacene SI HADJ MOHAND
1 parent bad1e728

correcting #7320

Showing 2 changed files with 17 additions and 10 deletions   Show diff stats
js/app/views/CatalogUI.js
... ... @@ -161,8 +161,12 @@ Ext.define('amdaUI.CatalogUI', {
161 161 timeTabNode.editInModule();
162 162 });
163 163 },
164   - // Convert UTC date to client local date
  164 + // Convert UTC date to client local date
165 165 convertUTCDateToLocalDate: function (date) {
  166 + if (date == null) {
  167 + return date;
  168 + }
  169 + ;
166 170 var newDate = new Date(date.getTime() + date.getTimezoneOffset() * 60 * 1000);
167 171  
168 172 var offset = date.getTimezoneOffset() / 60;
... ... @@ -533,6 +537,7 @@ Ext.define('amdaUI.CatalogUI', {
533 537 */
534 538 loadObject: function () {
535 539 // load object into form
  540 + this.object.set('created', this.convertUTCDateToLocalDate(this.object.get('created')));
536 541 this.formPanel.getForm().loadRecord(this.object);
537 542  
538 543 this.status = null;
... ... @@ -710,7 +715,6 @@ Ext.define('amdaUI.CatalogUI', {
710 715 init: function (config)
711 716 {
712 717 this.object = config.object;
713   - this.object.set('created', this.convertUTCDateToLocalDate(this.object.get('created')));
714 718 this.fieldName = new Ext.form.field.Text({
715 719 fieldLabel: 'Name',
716 720 allowBlank: false,
... ... @@ -802,10 +806,10 @@ Ext.define('amdaUI.CatalogUI', {
802 806 // selType: 'cellmodel',
803 807 plugins: [cellEditing, {ptype: 'bufferedrenderer'}],
804 808 listeners: {
805   - afterrender: function () {
806   - this.TTGrid.headerCt.resizer.tracker.gridBugFix = true;
807   - },
808   - scope: this
  809 + afterrender: function () {
  810 + this.TTGrid.headerCt.resizer.tracker.gridBugFix = true;
  811 + },
  812 + scope: this
809 813 },
810 814 dockedItems: [{
811 815 xtype: 'toolbar',
... ... @@ -974,7 +978,6 @@ Ext.define('amdaUI.CatalogUI', {
974 978 }]
975 979 },
976 980  
977   -
978 981 //statistical info
979 982 {
980 983 xtype: 'toolbar',
... ...
js/app/views/TimeTableUI.js
... ... @@ -66,6 +66,7 @@ Ext.define('amdaUI.TimeTableUI', {
66 66 * load object timetable into this view
67 67 */
68 68 loadObject: function () {
  69 + this.object.set('created', this.convertUTCDateToLocalDate(this.object.get('created')));
69 70 // load object into form
70 71 this.formPanel.getForm().loadRecord(this.object);
71 72  
... ... @@ -377,9 +378,13 @@ Ext.define('amdaUI.TimeTableUI', {
377 378 }
378 379 }
379 380 },
380   -
381   - // Convert UTC date to client local date
  381 +
  382 + // Convert UTC date to client local date
382 383 convertUTCDateToLocalDate: function (date) {
  384 + if (date == null) {
  385 + return date;
  386 + }
  387 + ;
383 388 var newDate = new Date(date.getTime() + date.getTimezoneOffset() * 60 * 1000);
384 389  
385 390 var offset = date.getTimezoneOffset() / 60;
... ... @@ -393,7 +398,6 @@ Ext.define('amdaUI.TimeTableUI', {
393 398 init: function (config)
394 399 {
395 400 this.object = config.object;
396   - this.object.set('created', this.convertUTCDateToLocalDate(this.object.get('created')));
397 401  
398 402 this.fieldName = new Ext.form.field.Text({
399 403 fieldLabel: 'Name*',
... ...