mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: for date manipulation use the SS_Datetime::now, otherwise it does not respect the mock date.
This commit is contained in:
parent
7f4541e9f0
commit
7026a488e6
@ -302,7 +302,7 @@ class Date extends DBField {
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function InPast() {
|
public function InPast() {
|
||||||
return strtotime($this->value) < time();
|
return strtotime($this->value) < SS_Datetime::now()->Format('U');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -310,7 +310,7 @@ class Date extends DBField {
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function InFuture() {
|
public function InFuture() {
|
||||||
return strtotime($this->value) > time();
|
return strtotime($this->value) > SS_Datetime::now()->Format('U');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -318,7 +318,7 @@ class Date extends DBField {
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function IsToday() {
|
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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user