Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[πŸ› BUG]: Workflow::now incorrect time zoneΒ #614

@root-aza

Description

@root-aza

No duplicates πŸ₯².

  • I have searched for a similar issue in our bug tracker and didn't find any solutions.

What happened?

Workflow::now method returns time in UTC timezone, although timezone is specified as Europe/Moscow.

Image

Output php-container:

root@7196f7dc3930:/app# php -r 'var_dump(date_default_timezone_get());'
Command line code:1:
string(13) "Europe/Moscow"

Output Temporal server:

/etc/temporal $ printenv
HOSTNAME=51cb1279e344
DB_PORT=5432
SHLVL=1
HOME=/home/temporal
ES_SEEDS=cash_vanta_temporal_elasticsearch
TEMPORAL_HOME=/etc/temporal
TEMPORAL_SHA=fb617040c84afe4c787645a33816fda2b6fe775b
DB=postgres12
TERM=xterm
POSTGRES_PWD=temporal
ENABLE_ES=true
TCTL_SHA=57f54ad72a8170e7e65b04df62c8a906f77df698
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
POSTGRES_USER=temporal
ES_VERSION=v7
DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/dev.yaml
TEMPORAL_CLI_ADDRESS=cash_vanta_temporal_server:7233
PWD=/etc/temporal
TEMPORAL_ADDRESS=cash_vanta_temporal_server:7233
TZ=Europe/Moscow
POSTGRES_SEEDS=cash_vanta_temporal_postgresql

/etc/temporal $ date
Fri Jan 24 20:19:02 MSK 2025

Code repoduce:

<?php

declare(strict_types=1);

namespace App\LoanApplication\Workflow;

use Temporal\Workflow;
use Temporal\Workflow\WorkflowInterface;
use Temporal\Workflow\WorkflowMethod;

#[WorkflowInterface]
final class TestWorkflow
{
    #[WorkflowMethod()]
    public function run(): \Generator
    {
        while (true) {
            yield Workflow::timer('3 seconds');

            $currentDate = yield Workflow::sideEffect(static fn(): \DateTimeImmutable => new \DateTimeImmutable());

            dump($currentDate, $currentDate->getTimeZone());
            dump(Workflow::now(), Workflow::now()->getTimezone());
        }
    }
}
Event history

202266ea-b306-4fba-be3b-261da729d500_events.json

Version

Temporal server: 1.22.4
RoadRunner: 2024.2.1
php-sdk: 2.11.2

Relevant log output

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions