mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-29 03:13:40 +01:00
Change some inconsistent relative dates
This commit is contained in:
parent
f0d2e72521
commit
6a2167f11b
@ -1303,15 +1303,12 @@ var et2_date_range = (function(){ "use strict"; return et2_inputWidget.extend({
|
|||||||
// Show description
|
// Show description
|
||||||
this.select.set_value(_value);
|
this.select.set_value(_value);
|
||||||
|
|
||||||
var now = new Date();
|
var tempDate = new Date();
|
||||||
now.setUTCMinutes(-now.getTimezoneOffset());
|
var today = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate(),0,-tempDate.getTimezoneOffset(),0);
|
||||||
now.setUTCHours(0);
|
|
||||||
now.setUTCSeconds(0);
|
|
||||||
|
|
||||||
|
|
||||||
// Use strings to avoid references
|
// Use strings to avoid references
|
||||||
this.from.set_value(now.toJSON());
|
this.from.set_value(today.toJSON());
|
||||||
this.to.set_value(now.toJSON());
|
this.to.set_value(today.toJSON());
|
||||||
|
|
||||||
var relative = null;
|
var relative = null;
|
||||||
for(var index in et2_date_range.relative_dates)
|
for(var index in et2_date_range.relative_dates)
|
||||||
@ -1325,7 +1322,7 @@ var et2_date_range = (function(){ "use strict"; return et2_inputWidget.extend({
|
|||||||
if(relative)
|
if(relative)
|
||||||
{
|
{
|
||||||
var dates = ["from","to"];
|
var dates = ["from","to"];
|
||||||
var value = now.toJSON();
|
var value = today.toJSON();
|
||||||
for(var i = 0; i < dates.length; i++)
|
for(var i = 0; i < dates.length; i++)
|
||||||
{
|
{
|
||||||
var date = dates[i];
|
var date = dates[i];
|
||||||
@ -1353,13 +1350,16 @@ jQuery.extend(et2_date_range,
|
|||||||
{
|
{
|
||||||
value: 'Today',
|
value: 'Today',
|
||||||
label: 'Today',
|
label: 'Today',
|
||||||
from: '',
|
from: function(date) {return date;},
|
||||||
to: '+1d'
|
to: function(date) {return date;}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Yesterday',
|
label: 'Yesterday',
|
||||||
value: 'Yesterday',
|
value: 'Yesterday',
|
||||||
from: '-1d',
|
from: function(date) {
|
||||||
|
date.setUTCDate(date.getUTCDate() - 1);
|
||||||
|
return date;
|
||||||
|
},
|
||||||
to: ''
|
to: ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1387,20 +1387,49 @@ jQuery.extend(et2_date_range,
|
|||||||
{
|
{
|
||||||
label: 'This month',
|
label: 'This month',
|
||||||
value: 'This month',
|
value: 'This month',
|
||||||
from: '',
|
from: function(date)
|
||||||
to: '+1m'
|
{
|
||||||
|
date.setUTCDate(1);
|
||||||
|
return date;
|
||||||
|
},
|
||||||
|
to: function(date)
|
||||||
|
{
|
||||||
|
date.setUTCMonth(date.getUTCMonth()+1);
|
||||||
|
date.setUTCDate(0);
|
||||||
|
return date;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Last month',
|
label: 'Last month',
|
||||||
value: 'Last month',
|
value: 'Last month',
|
||||||
from: '-1m',
|
from: function(date)
|
||||||
to: ''
|
{
|
||||||
|
date.setUTCMonth(date.getUTCMonth() - 1);
|
||||||
|
date.setUTCDate(1);
|
||||||
|
return date;
|
||||||
|
},
|
||||||
|
to: function(date)
|
||||||
|
{
|
||||||
|
date.setUTCMonth(date.getUTCMonth()+1);
|
||||||
|
date.setUTCDate(0);
|
||||||
|
return date;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Last 3 months',
|
label: 'Last 3 months',
|
||||||
value: 'Last 3 months',
|
value: 'Last 3 months',
|
||||||
from: '-3m',
|
from: function(date)
|
||||||
to: ''
|
{
|
||||||
|
date.setUTCMonth(date.getUTCMonth() - 2);
|
||||||
|
date.setUTCDate(1);
|
||||||
|
return date;
|
||||||
|
},
|
||||||
|
to: function(date)
|
||||||
|
{
|
||||||
|
date.setUTCMonth(date.getUTCMonth()+3);
|
||||||
|
date.setUTCDate(0);
|
||||||
|
return date;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
'This quarter'=> array(0,0,0,0, 0,0,0,0), // Just a marker, needs special handling
|
'This quarter'=> array(0,0,0,0, 0,0,0,0), // Just a marker, needs special handling
|
||||||
|
Loading…
Reference in New Issue
Block a user