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

Bug with requiredTimeStart and requiredTime #2

Closed
projct1 opened this issue Dec 19, 2016 · 3 comments
Closed

Bug with requiredTimeStart and requiredTime #2

projct1 opened this issue Dec 19, 2016 · 3 comments
Assignees
Labels

Comments

@projct1
Copy link
Collaborator

projct1 commented Dec 19, 2016

Hi)

I creating point and pass this vars:

requiredTimeStart:

Carbon {#298
  +"date": "2016-12-20 12:00:00.000000"
  +"timezone_type": 3
  +"timezone": "Europe/Moscow"
}

requiredTime:

Carbon {#298
  +"date": "2016-12-20 13:00:00.000000"
  +"timezone_type": 3
  +"timezone": "Europe/Moscow"
}

And after export (Exportable interface) i have two same dates:

[
    "required_time_start" => "2016-12-20 13:00:00"
    "required_time" => "2016-12-20 13:00:00"
]
@kstkn kstkn added the bug label Dec 19, 2016
@kstkn kstkn self-assigned this Dec 19, 2016
@kstkn
Copy link
Owner

kstkn commented Dec 19, 2016

Tried to reproduce:

<?php

require_once __DIR__ . '/vendor/autoload.php';

$point = new \Dostavista\Point('1', new DateTime('2016-12-20 12:00:00.000000'), new DateTime('2016-12-20 13:00:00.000000'), '2');
var_dump($point->export());

array(12) {
  ["address"]=>
  string(1) "1"
  ["note"]=>
  NULL
  ["required_time_start"]=>
  string(19) "2016-12-20 12:00:00"
  ["required_time"]=>
  string(19) "2016-12-20 13:00:00"
  ["contact_person"]=>
  NULL
  ["phone"]=>
  string(1) "2"
  ["taking"]=>
  NULL
  ["weight"]=>
  NULL
  ["client_order_id"]=>
  NULL
  ["in_outline"]=>
  NULL
  ["latitude"]=>
  NULL
  ["longitude"]=>
  NULL
}

Times differ

@kstkn
Copy link
Owner

kstkn commented Dec 19, 2016

Ahh, look at your Carbon instances:

requiredTimeStart:

Carbon {#298

requiredTime:

Carbon {#298

It's same. You're creating Carbon instance with 12:00, then change it to 13:00, that's why both properties has 13:00

@kstkn kstkn closed this as completed Dec 19, 2016
@projct1
Copy link
Collaborator Author

projct1 commented Dec 19, 2016

Hmm, true, thanks =)

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

2 participants