Commit Graph

16 Commits

Author SHA1 Message Date
Ralf Becker
53c20ed5f7 allow to pass JSON serialized date-array with date&timezone to constructor 2021-05-14 20:24:14 +02:00
Ralf Becker
1259ae8d04 More automatic timezone handling schema for new code (hopefully not breaking existing code):
1. SO converts all timestamps to Api\DateTime objects using Api\DateTime::server2user($ts, 'object')
 - Api\Storage and Api\Storage\Base class do that automatic if using 'object' as $timestamp_type constructor parameter
 - if using just Api\Db you need to iterate over your selects manually and apply Api\DateTime::server2user($ts, 'object')
 - timestamps are store in DB in server timezone and above conversation honors that and additionally set the user TZ
2. Rest of the app should keep all timestamps as Api\DateTime objects
 - direct comparison works for Api\DateTime (and PHP \DateTime) as __toString() method automatic converts to UTC timestamps
 - do NOT convert them to timezone-less timestamps and no further timezone conversation needed for output with eTemplate
3. eTemplate2 converts automatic to user timezone for displaying dates and times
 - you need to use <date-time ... data_format="object"/> to get Api\DateTime objects back from eTemplate!
4. Api\Db converts automatic to server timezone when quoting DateTime objects for integer or timestamp columns
5. only output other then eTemplate might need to set a timezone different from the user TZ before calling $ts->format()
2021-01-26 11:16:42 +02:00
Ralf Becker
fe320938e5 document EGroupware timestamps and remove own __toString() method to be able to compare objects 2021-01-22 15:18:39 +02:00
Ralf Becker
1f7682d87a fixing two PHP Warnings 2019-06-04 09:43:59 +02:00
nathangray
9c29079ddf Silence warning about time in array format by passing it to constructor 2018-02-14 08:38:48 -07:00
nathangray
f07dbf7439 Attempt to prefer user's date format when parsing date from a string.
Should fix merging into spreadsheet problems with certain date formats (dd/mm/yyyy)
2018-02-02 11:37:30 -07:00
Ralf Becker
b9594ea357 fix typo 2017-10-31 10:49:12 +01:00
nathangray
4d6ba96115 Move commented-out DateTime tests into their own class 2017-02-06 13:08:05 -07:00
Ralf Becker
adaeabe592 fix wrong namespaced Exception: \DateTime throws \Exception 2016-09-28 11:17:19 +02:00
Ralf Becker
e34fe9a4e7 using Acl::(ADD|READ|EDIT|DELETE|PRIVAT) constants instead old EGW_ACL_* defines and fix some namespace errors found by doc/check_namespace.php 2016-05-11 19:23:14 +00:00
Ralf Becker
fc2e620652 replace old classname 2016-05-06 16:15:06 +00:00
Nathan Gray
66386c1a42 Remove 1 week limit if end date is not provided 2016-04-27 15:43:38 +00:00
Ralf Becker
77c5102792 fixed more namespace issues found by doc/check_namespace.php I wrote and forgot about it ;-) 2016-03-21 21:21:40 +00:00
Ralf Becker
8a14cd54b8 explicilty import DateInterval, so phpDoc is correct too 2016-03-21 09:45:10 +00:00
Nathan Gray
c2eaabaa5b Fix namespace error 2016-03-18 15:37:57 +00:00
Ralf Becker
a24c1121a2 move egw_time class to Api\DateTime 2016-03-05 11:14:01 +00:00