Permalink
Browse files

BUGFIX: for date manipulation use the SS_Datetime::now, otherwise it …

…does not respect the mock date.
  • Loading branch information...
1 parent 7f4541e commit 7026a488e617f7a1b7e31ee598a5c340d12397b3 @mateusz mateusz committed with chillu May 23, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 model/fieldtypes/Date.php
@@ -302,23 +302,23 @@ public function requireField() {
* @return boolean
*/
public function InPast() {
- return strtotime($this->value) < time();
+ return strtotime($this->value) < SS_Datetime::now()->Format('U');
}
/**
* Returns true if date is in the future.
* @return boolean
*/
public function InFuture() {
- return strtotime($this->value) > time();
+ return strtotime($this->value) > SS_Datetime::now()->Format('U');
}
/**
* Returns true if date is today.
* @return boolean
*/
public function IsToday() {
- return (date('Y-m-d', strtotime($this->value)) == date('Y-m-d', time()));
+ return (date('Y-m-d', strtotime($this->value)) == SS_Datetime::now()->Format('Y-m-d'));
}
/**

0 comments on commit 7026a48

Please sign in to comment.