Skip to content

Commit c52f308

Browse files
committed
docs: add user guide
1 parent b1418a1 commit c52f308

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

user_guide_src/source/changelogs/v4.4.6.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ Release Date: Unreleased
1414
BREAKING
1515
********
1616

17+
Time::createFromTimestamp()
18+
===========================
19+
20+
A bug that caused :ref:`Time::createFromTimestamp() <time-createfromtimestamp>`
21+
to return a Time instance with a timezone of UTC has been fixed.
22+
23+
Starting with this version, when you do not specify a timezone, a Time instance
24+
with the app's timezone is returned by default.
25+
1726
***************
1827
Message Changes
1928
***************

user_guide_src/source/installation/upgrade_446.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ Mandatory File Changes
2020
Breaking Changes
2121
****************
2222

23+
Time::createFromTimestamp() Timezone Change
24+
===========================================
25+
26+
When you do not specify a timezone, now
27+
:ref:`Time::createFromTimestamp() <time-createfromtimestamp>` returns a Time
28+
instance with the app's timezone is returned.
29+
30+
If you want to keep the timezone UTC, you need to call ``setTimezone('UTC')``::
31+
32+
use CodeIgniter\I18n\Time;
33+
34+
$time = Time::createFromTimestamp(1501821586)->setTimezone('UTC');
35+
36+
2337
*********************
2438
Breaking Enhancements
2539
*********************

user_guide_src/source/libraries/time.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,18 @@ and returns a ``Time`` instance, instead of DateTimeImmutable:
114114

115115
.. literalinclude:: time/011.php
116116

117+
.. _time-createfromtimestamp:
118+
117119
createFromTimestamp()
118120
=====================
119121

120122
This method takes a UNIX timestamp and, optionally, the timezone and locale, to create a new Time instance:
121123

122124
.. literalinclude:: time/012.php
123125

126+
.. note:: Due to a bug, prior to v4.4.6, this method returned a Time instance
127+
in timezone UTC when you do not specify a timezone.
128+
124129
createFromInstance()
125130
====================
126131

0 commit comments

Comments
 (0)