Skip to content

Commit

Permalink
docs: add user guide
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Feb 14, 2024
1 parent b1418a1 commit c52f308
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
9 changes: 9 additions & 0 deletions user_guide_src/source/changelogs/v4.4.6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ Release Date: Unreleased
BREAKING
********

Time::createFromTimestamp()
===========================

A bug that caused :ref:`Time::createFromTimestamp() <time-createfromtimestamp>`
to return a Time instance with a timezone of UTC has been fixed.

Starting with this version, when you do not specify a timezone, a Time instance
with the app's timezone is returned by default.

***************
Message Changes
***************
Expand Down
14 changes: 14 additions & 0 deletions user_guide_src/source/installation/upgrade_446.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ Mandatory File Changes
Breaking Changes
****************

Time::createFromTimestamp() Timezone Change
===========================================

When you do not specify a timezone, now
:ref:`Time::createFromTimestamp() <time-createfromtimestamp>` returns a Time
instance with the app's timezone is returned.

If you want to keep the timezone UTC, you need to call ``setTimezone('UTC')``::

use CodeIgniter\I18n\Time;

$time = Time::createFromTimestamp(1501821586)->setTimezone('UTC');


*********************
Breaking Enhancements
*********************
Expand Down
5 changes: 5 additions & 0 deletions user_guide_src/source/libraries/time.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,18 @@ and returns a ``Time`` instance, instead of DateTimeImmutable:

.. literalinclude:: time/011.php

.. _time-createfromtimestamp:

createFromTimestamp()
=====================

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

.. literalinclude:: time/012.php

.. note:: Due to a bug, prior to v4.4.6, this method returned a Time instance
in timezone UTC when you do not specify a timezone.

createFromInstance()
====================

Expand Down

0 comments on commit c52f308

Please sign in to comment.