mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:50 +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
a4d18fdce2
commit
9e60cadb70
@ -62,17 +62,17 @@ class etemplate_widget_date extends etemplate_widget_transformer
|
||||
|
||||
$form_name = self::form_name($cname, $this->id);
|
||||
$value =& self::get_array(self::$request->content, $form_name, false, true);
|
||||
|
||||
|
||||
if($this->type != 'date-duration' && $value)
|
||||
{
|
||||
// string with formatting letters like for php's date() method
|
||||
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
|
||||
{
|
||||
$date = new egw_time((int)$value, new DateTimeZone('UTC'));
|
||||
$date = new egw_time($value);
|
||||
}
|
||||
if($this->type == 'date-timeonly')
|
||||
{
|
||||
@ -80,9 +80,8 @@ class etemplate_widget_date extends etemplate_widget_transformer
|
||||
}
|
||||
if($date)
|
||||
{
|
||||
// Set timezone to UTC so javascript doesn't add/subtract anything
|
||||
$date->setTimezone(new DateTimeZone('UTC'));
|
||||
$value = $date->format(egw_time::W3C);
|
||||
// postfix date-string with "Z" so javascript doesn't add/subtract anything
|
||||
$value = $date->format('Y-m-d\TH:i:s\Z');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -109,7 +108,7 @@ class etemplate_widget_date extends etemplate_widget_transformer
|
||||
{
|
||||
$value = self::get_array($content, $form_name);
|
||||
$valid =& self::get_array($validated, $form_name, true);
|
||||
|
||||
|
||||
if ((string)$value === '' && $this->attrs['needed'])
|
||||
{
|
||||
self::set_validation_error($form_name,lang('Field must not be empty !!!'));
|
||||
|
@ -206,7 +206,7 @@ var et2_date = et2_inputWidget.extend(
|
||||
*
|
||||
* 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()
|
||||
{
|
||||
@ -390,7 +390,7 @@ var et2_date = et2_inputWidget.extend(
|
||||
|
||||
// Convert to timestamp - no seconds
|
||||
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"]);
|
||||
|
Loading…
Reference in New Issue
Block a user