aboutsummaryrefslogtreecommitdiffstats
path: root/include/datetime.php
diff options
context:
space:
mode:
authorSimon L'nu <simon.lnu@gmail.com>2012-04-09 19:20:51 -0400
committerSimon L'nu <simon.lnu@gmail.com>2012-04-09 19:20:51 -0400
commit16c48b220070edc84c4e27bb680498f31066f3ba (patch)
tree31876f26f919cb896021fd235ccde8bf6e2ca744 /include/datetime.php
parentf1db6907860efcd4f48380bb8c0f88272adb91a8 (diff)
parent0fd05171d00449d81d060c293dfa0fc7ce814515 (diff)
downloadvolse-hubzilla-16c48b220070edc84c4e27bb680498f31066f3ba.tar.gz
volse-hubzilla-16c48b220070edc84c4e27bb680498f31066f3ba.tar.bz2
volse-hubzilla-16c48b220070edc84c4e27bb680498f31066f3ba.zip
Merge branch 'master', remote-tracking branch 'remotes/upstream/master'
* remotes/upstream/master: bbcode toolbar attached to the comment text field minor css-fixes diabook-themes: small icon fix diabook-nav-icons with gradient use local_user for tag completion if available. See bug #368 more sane defaults datetime_convert fix empty string timezone Some new German translations send zrl after dfrn_request homecoming for manual entries fix to wall_upload photos default permissions to use cid rather than uid. fixed z-index of youtube-vids fixed bug to hide right_side * master:
Diffstat (limited to 'include/datetime.php')
-rw-r--r--include/datetime.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/datetime.php b/include/datetime.php
index 6d395fe3f..f4dcfce62 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -80,6 +80,16 @@ function field_timezone($name='timezone', $label='', $current = 'America/Los_Ang
if(! function_exists('datetime_convert')) {
function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d H:i:s") {
+ // Defaults to UTC if nothing is set, but throws an exception if set to empty string.
+ // Provide some sane defaults regardless.
+
+ if($from === '')
+ $from = 'UTC';
+ if($to === '')
+ $to = 'UTC';
+ if($s === '')
+ $s = 'now';
+
// Slight hackish adjustment so that 'zero' datetime actually returns what is intended
// otherwise we end up with -0001-11-30 ...
// add 32 days so that we at least get year 00, and then hack around the fact that