Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FrozenDate::createFromTimestamp doesnt use timezone correctly #8251

Closed
Graziel opened this issue Feb 13, 2016 · 2 comments
Closed

FrozenDate::createFromTimestamp doesnt use timezone correctly #8251

Graziel opened this issue Feb 13, 2016 · 2 comments
Assignees
Labels
Milestone

Comments

@Graziel
Copy link
Contributor

Graziel commented Feb 13, 2016

    <?php
use Cake\I18n\FrozenDate;
    ?>

    <?= date_default_timezone_get() ?>
    <?php $time1 = FrozenDate::create($year, $month, 1)->timestamp ?>
    <?= $time1 ?>
    <?= FrozenDate::createFromTimestamp($time1) ?>

    <?php date_default_timezone_set('Europe/Paris') ?>
    <?php $time3 = FrozenDate::create($year, $month, 1)->timestamp ?>
    <?= date('Y-m-d 00:00:00', $time3) ?>
    <?= $time3 ?>
    <?= FrozenDate::createFromTimestamp($time3) ?>

Gives:

    UTC 
    1454284800 
    01/02/2016 

    2016-02-01 00:00:00 
    1454284800 
    31/01/2016

but if im using

<?= new FrozenDate($time3) ?>

it gives correct result also while switching to \I18n\Date gives me

UTC 
1454284800 
01/01/1970 

2016-02-01 00:00:00 
1454284800 
01/01/1970

and again using

<?= new Date($time3) ?>

gives correct results

@markstory reminder "I bet I missed 'correcting' createFromTimestamp() then :)"

@lorenzo lorenzo added the defect label Feb 13, 2016
@lorenzo lorenzo added this to the 3.2.3 milestone Feb 13, 2016
@markstory
Copy link
Member

I'll take a look. This might be an issue in cakephp/chronos.

@markstory
Copy link
Member

This issue was moved to cakephp/chronos#81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants