Skip to content

Commit

Permalink
Update date comparisons to be strict in CakeTime
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Crowe committed Oct 30, 2013
1 parent 245c8eb commit 507bb44
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/Cake/Utility/CakeTime.php
Expand Up @@ -514,7 +514,7 @@ public static function isPast($dateString, $timezone = null) {
public static function isThisWeek($dateString, $timezone = null) {
$timestamp = self::fromString($dateString, $timezone);
$now = self::fromString('now', $timezone);
return date('W o', $timestamp) == date('W o', $now);
return date('W o', $timestamp) === date('W o', $now);
}

/**
Expand All @@ -528,7 +528,7 @@ public static function isThisWeek($dateString, $timezone = null) {
public static function isThisMonth($dateString, $timezone = null) {
$timestamp = self::fromString($dateString, $timezone);
$now = self::fromString('now', $timezone);
return date('m Y', $timestamp) == date('m Y', $now);
return date('m Y', $timestamp) === date('m Y', $now);
}

/**
Expand All @@ -542,7 +542,7 @@ public static function isThisMonth($dateString, $timezone = null) {
public static function isThisYear($dateString, $timezone = null) {
$timestamp = self::fromString($dateString, $timezone);
$now = self::fromString('now', $timezone);
return date('Y', $timestamp) == date('Y', $now);
return date('Y', $timestamp) === date('Y', $now);
}

/**
Expand All @@ -556,7 +556,7 @@ public static function isThisYear($dateString, $timezone = null) {
public static function wasYesterday($dateString, $timezone = null) {
$timestamp = self::fromString($dateString, $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);
}

/**
Expand All @@ -570,7 +570,7 @@ public static function wasYesterday($dateString, $timezone = null) {
public static function isTomorrow($dateString, $timezone = null) {
$timestamp = self::fromString($dateString, $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);
}

/**
Expand Down

0 comments on commit 507bb44

Please sign in to comment.