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

Incorrect timezone parsing W3C + DTS #187

Open
GrupoWebex opened this issue Oct 10, 2019 · 0 comments
Open

Incorrect timezone parsing W3C + DTS #187

GrupoWebex opened this issue Oct 10, 2019 · 0 comments

Comments

@GrupoWebex
Copy link

moment js example format output: 2019-10-27T00:00:00+02:00

I send on post to php:
$test = new \Moment\Moment('2019-10-27T00:00:00+02:00');
print_r($test);
echo $test->format();
$test2 = $test->cloning()->addDays(1);
echo $test2->format();

invalid output ===========
Moment\Moment Object ( [rawDateTimeString:Moment\Moment:private] => 2019-10-27T00:00:00+02:00 [timezoneString:Moment\Moment:private] => Europe/Madrid [immutableMode:Moment\Moment:private] => [date] => 2019-10-27 00:00:00.000000 [timezone_type] => 1 [timezone] => +02:00 )
2019-10-27T00:00:00+0200
2019-10-28T00:00:00+0200

============================================
Then i go default params on main function:
$test = new \Moment\Moment('2019-10-27T00:00:00','Europe/Madrid');
print_r($test);
echo $test->format();
$test2 = $test->cloning()->addDays(1);
echo $test2->format();

valid output ===========
Moment\Moment Object ( [rawDateTimeString:Moment\Moment:private] => 2019-10-27T00:00:00 [timezoneString:Moment\Moment:private] => Europe/Madrid [immutableMode:Moment\Moment:private] => [date] => 2019-10-27 00:00:00.000000 [timezone_type] => 3 [timezone] => Europe/Madrid )
2019-10-27T00:00:00+0200
2019-10-28T00:00:00+0100

There is some way to do it compatible with default momentjs output?
(YYYY-MM-DDTHH:mm:ssZZ)

Thanks for support

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

No branches or pull requests

1 participant