aboutsummaryrefslogtreecommitdiffstats
path: root/include/datetime.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-03-15 10:31:23 +0000
committerMario <mario@mariovavti.com>2021-03-15 10:31:23 +0000
commita5ac3888898d709bdd63900dff79b21823477d85 (patch)
treee25d7194c253772f2a573783e7f8f5b38a38d150 /include/datetime.php
parent4be123dc84cdc6ab47b194d49dff9498f7ea27df (diff)
downloadvolse-hubzilla-a5ac3888898d709bdd63900dff79b21823477d85.tar.gz
volse-hubzilla-a5ac3888898d709bdd63900dff79b21823477d85.tar.bz2
volse-hubzilla-a5ac3888898d709bdd63900dff79b21823477d85.zip
air: fix calculate_adue() to return false if the value is zero and do not hardcode regexpire - adding the max setting (99 years) should be fine.
Diffstat (limited to 'include/datetime.php')
-rw-r--r--include/datetime.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/datetime.php b/include/datetime.php
index 0b8722b4f..4c7105138 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -554,12 +554,16 @@ function update_birthdays() {
if ( preg_match( '/^[0-9]{1,2}[ihdwmy]{1}$/', $duri ) && ($sign == '+' || $sign == '-') ) {
$duru = substr( $duri, -1);
$durn = substr( $duri, 0, -1);
+
+ if(!$durn)
+ return false;
+
$due = date( 'Y-m-d H:i:s', strtotime(
- '+' . $durn . ' '
- . str_replace( array(':i',':h',':d',':w',':m',':y'),
+ '+' . $durn . ' '
+ . str_replace( array(':i',':h',':d',':w',':m',':y'),
array('minutes', 'hours', 'days', 'weeks', 'months', 'years'),
- ( ':'. $duru )
- )
+ ( ':'. $duru )
+ )
)
);
return array( 'durn' => $durn, 'duru' => $duru, 'due' => $due);