developer.jelix.org is not used any more and exists only for
history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.
Opened 10 years ago
Closed 10 years ago
#1164 closed bug (fixed)
bug sur jDateTime::now
Reported by: | hadrien | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | Jelix 1.1.7 |
Component: | jelix:utils | Version: | 1.1.6 |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Documentation needed: | no | |
Hosting Provider: | Php version: |
Description
La méthode now de jDateTime insère des string au lieu d'entier, ce qui entraine quelques effets indésirables tels que :
object(jDateTime)[29] public 'day' => string '01' (length=2) public 'month' => string '09' (length=2) public 'year' => string '2010' (length=4) public 'hour' => string '10' (length=2) public 'minute' => string '55' (length=2) public 'second' => string '15' (length=2) public 'defaultFormat' => int 11 [exception 0] (210)The given locale key "jelix~date_time.day.01.ordinal" does not exists in the default lang for the UTF-8 charset /home/hadrien/public_html/sw3/lib/jelix/core/jLocale.class.php 91
On patchera ce problème simplement :
diff --git a/lib/jelix/utils/jDateTime.class.php b/lib/jelix/utils/jDateTime.class.php index 049d5a9..e42e9a2 100644 --- a/lib/jelix/utils/jDateTime.class.php +++ b/lib/jelix/utils/jDateTime.class.php @@ -449,12 +449,12 @@ class jDateTime { * set date to current datetime */ public function now() { - $this->year = date('Y'); - $this->month = date('m'); - $this->day = date('d'); - $this->hour = date('H'); - $this->minute = date('i'); - $this->second = date('s'); + $this->year = intval(date('Y')); + $this->month = intval(date('m')); + $this->day = intval(date('d')); + $this->hour = intval(date('H')); + $this->minute = intval(date('i')); + $this->second = intval(date('s')); }
Change History (1)
comment:1 Changed 10 years ago by laurentj
- Component changed from jelix to jelix:utils
- Milestone set to Jelix 1.1.7
- Resolution set to fixed
- review changed from review? to review+
- Status changed from new to closed
- Version changed from 1.2b1 to 1.1.6
Note: See
TracTickets for help on using
tickets.
Fixed