mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-14 20:14:11 +01:00
fixed date client/server protocol to always just append "Z" after seconds, so apps can compare date values
This commit is contained in:
parent
c775582af2
commit
f691946560
@ -68,11 +68,11 @@ class etemplate_widget_date extends etemplate_widget_transformer
|
|||||||
// string with formatting letters like for php's date() method
|
// string with formatting letters like for php's date() method
|
||||||
if ($this->attrs['dataformat'] && !is_numeric($value))
|
if ($this->attrs['dataformat'] && !is_numeric($value))
|
||||||
{
|
{
|
||||||
$date = date_create_from_format($this->attrs['dataformat'], $value, new DateTimeZone('UTC'));
|
$date = date_create_from_format($this->attrs['dataformat'], $value, egw_time::$user_timezone);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$date = new egw_time((int)$value, new DateTimeZone('UTC'));
|
$date = new egw_time($value);
|
||||||
}
|
}
|
||||||
if($this->type == 'date-timeonly')
|
if($this->type == 'date-timeonly')
|
||||||
{
|
{
|
||||||
@ -80,9 +80,8 @@ class etemplate_widget_date extends etemplate_widget_transformer
|
|||||||
}
|
}
|
||||||
if($date)
|
if($date)
|
||||||
{
|
{
|
||||||
// Set timezone to UTC so javascript doesn't add/subtract anything
|
// postfix date-string with "Z" so javascript doesn't add/subtract anything
|
||||||
$date->setTimezone(new DateTimeZone('UTC'));
|
$value = $date->format('Y-m-d\TH:i:s\Z');
|
||||||
$value = $date->format(egw_time::W3C);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ var et2_date = et2_inputWidget.extend(
|
|||||||
*
|
*
|
||||||
* You can use set_value to set a timestamp.
|
* You can use set_value to set a timestamp.
|
||||||
*
|
*
|
||||||
* @return {number|null} timestamp (seconds since 1970-01-01
|
* @return {number|null} timestamp (seconds since 1970-01-01)
|
||||||
*/
|
*/
|
||||||
get_time: function()
|
get_time: function()
|
||||||
{
|
{
|
||||||
@ -390,7 +390,7 @@ var et2_date = et2_inputWidget.extend(
|
|||||||
|
|
||||||
// Convert to timestamp - no seconds
|
// Convert to timestamp - no seconds
|
||||||
this.date.setSeconds(0,0);
|
this.date.setSeconds(0,0);
|
||||||
return this.date.toJSON();
|
return this.date.toJSON().replace(/\.\d{3}Z$/, 'Z');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
et2_register_widget(et2_date, ["date", "date-time", "date-timeonly"]);
|
et2_register_widget(et2_date, ["date", "date-time", "date-timeonly"]);
|
||||||
|
Loading…
Reference in New Issue
Block a user