mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Update date comparisons to be strict in CakeTime
This commit is contained in:
parent
245c8eb8be
commit
507bb44301
1 changed files with 5 additions and 5 deletions
|
@ -514,7 +514,7 @@ class CakeTime {
|
||||||
public static function isThisWeek($dateString, $timezone = null) {
|
public static function isThisWeek($dateString, $timezone = null) {
|
||||||
$timestamp = self::fromString($dateString, $timezone);
|
$timestamp = self::fromString($dateString, $timezone);
|
||||||
$now = self::fromString('now', $timezone);
|
$now = self::fromString('now', $timezone);
|
||||||
return date('W o', $timestamp) == date('W o', $now);
|
return date('W o', $timestamp) === date('W o', $now);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -528,7 +528,7 @@ class CakeTime {
|
||||||
public static function isThisMonth($dateString, $timezone = null) {
|
public static function isThisMonth($dateString, $timezone = null) {
|
||||||
$timestamp = self::fromString($dateString, $timezone);
|
$timestamp = self::fromString($dateString, $timezone);
|
||||||
$now = self::fromString('now', $timezone);
|
$now = self::fromString('now', $timezone);
|
||||||
return date('m Y', $timestamp) == date('m Y', $now);
|
return date('m Y', $timestamp) === date('m Y', $now);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -542,7 +542,7 @@ class CakeTime {
|
||||||
public static function isThisYear($dateString, $timezone = null) {
|
public static function isThisYear($dateString, $timezone = null) {
|
||||||
$timestamp = self::fromString($dateString, $timezone);
|
$timestamp = self::fromString($dateString, $timezone);
|
||||||
$now = self::fromString('now', $timezone);
|
$now = self::fromString('now', $timezone);
|
||||||
return date('Y', $timestamp) == date('Y', $now);
|
return date('Y', $timestamp) === date('Y', $now);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -556,7 +556,7 @@ class CakeTime {
|
||||||
public static function wasYesterday($dateString, $timezone = null) {
|
public static function wasYesterday($dateString, $timezone = null) {
|
||||||
$timestamp = self::fromString($dateString, $timezone);
|
$timestamp = self::fromString($dateString, $timezone);
|
||||||
$yesterday = self::fromString('yesterday', $timezone);
|
$yesterday = self::fromString('yesterday', $timezone);
|
||||||
return date('Y-m-d', $timestamp) == date('Y-m-d', $yesterday);
|
return date('Y-m-d', $timestamp) === date('Y-m-d', $yesterday);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -570,7 +570,7 @@ class CakeTime {
|
||||||
public static function isTomorrow($dateString, $timezone = null) {
|
public static function isTomorrow($dateString, $timezone = null) {
|
||||||
$timestamp = self::fromString($dateString, $timezone);
|
$timestamp = self::fromString($dateString, $timezone);
|
||||||
$tomorrow = self::fromString('tomorrow', $timezone);
|
$tomorrow = self::fromString('tomorrow', $timezone);
|
||||||
return date('Y-m-d', $timestamp) == date('Y-m-d', $tomorrow);
|
return date('Y-m-d', $timestamp) === date('Y-m-d', $tomorrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue