Skip to content

Commit

Permalink
Updated vdate() view function, now it supports numeric and string dat…
Browse files Browse the repository at this point in the history
…e values
  • Loading branch information
Olexandr Nazarenko committed Dec 24, 2014
1 parent e892837 commit 7e5862f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,11 @@ function vdate( $name, $format = 'h:i d.m.y', $function = 'date' )
$m = & m();

// If view variable is set - echo with format
if ( $m->offsetExists( $name )) echo $function( $format, strtotime($m[ $name ]));
if ( $m->offsetExists( $name )) {
// If data passed as string - convert to number
$dateValue = !is_numeric($m[$name]) ? strtotime($m[$name]) : $m[$name];
echo $function( $format, $dateValue);
}

}

Expand Down

0 comments on commit 7e5862f

Please sign in to comment.