diff options
Diffstat (limited to 'src/Dates.php')
| -rw-r--r-- | src/Dates.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Dates.php b/src/Dates.php index 2fe93cb..d7ed6c7 100644 --- a/src/Dates.php +++ b/src/Dates.php | |||
| @@ -59,8 +59,7 @@ class Dates | |||
| 59 | $input = $this->dashOrSlash($input); // formate pour strtotime() | 59 | $input = $this->dashOrSlash($input); // formate pour strtotime() |
| 60 | $this->setDayMonthYear($input); | 60 | $this->setDayMonthYear($input); |
| 61 | 61 | ||
| 62 | //~ if(checkdate($splitedDate[0], $splitedDate[1], $splitedDate[2])) | 62 | if(checkdate($this->month, $this->day, $this->year)) // checkdate() veut un format américain |
| 63 | if(checkdate($this->day, $this->month, $this->year)) | ||
| 64 | { | 63 | { |
| 65 | $this->date = $input; | 64 | $this->date = $input; |
| 66 | $this->timestamp = strtotime($input); // date (string) -> timestamp (int) | 65 | $this->timestamp = strtotime($input); // date (string) -> timestamp (int) |
| @@ -87,13 +86,18 @@ class Dates | |||
| 87 | 86 | ||
| 88 | if(self::$date_format === 'euro') | 87 | if(self::$date_format === 'euro') |
| 89 | { | 88 | { |
| 89 | $this->day = $splitedDate[0]; | ||
| 90 | $this->month = $splitedDate[1]; | ||
| 91 | } | ||
| 92 | elseif(self::$date_format === 'usa') | ||
| 93 | { | ||
| 90 | $this->day = $splitedDate[1]; | 94 | $this->day = $splitedDate[1]; |
| 91 | $this->month = $splitedDate[0]; | 95 | $this->month = $splitedDate[0]; |
| 92 | } | 96 | } |
| 93 | else | 97 | else |
| 94 | { | 98 | { |
| 95 | $this->day = $splitedDate[0]; | 99 | echo("Le fichier config.php comporte une erreur. La variable $date_format doit avoir pour valeur 'euro' ou 'usa'"); |
| 96 | $this->month = $splitedDate[1]; | 100 | die(); // brutal |
| 97 | } | 101 | } |
| 98 | $this->year = $splitedDate[2]; | 102 | $this->year = $splitedDate[2]; |
| 99 | } | 103 | } |
