电子邮件卡显示正确的时间,日历没有

发布于 2025-01-23 08:59:18 字数 1767 浏览 1 评论 0原文

我已经批准了活动卡并有效。 Gmail中的卡显示了正确的时间(柏林,柏林,晚上10点),但在Google日历上显示为上午7点。

当我创建卡时,我将日期从柏林转换为UTC,然后返回ISO 8601格式的日期:

$dt = new \DateTime($dateString, new \DateTimeZone($this->timezone ?? \Phpr::$config->get('TIMEZONE')));
$dt->setTimezone(new \DateTimeZone("UTC"));

return $dt->format("c");

这是结果标记:

<script type="application/ld+json">
    {
        "@context": "http://schema.org",
        "@type": "EventReservation",
        "reservationNumber": "2400071",
        "reservationStatus": "http://schema.org/Confirmed",
        "underName": {
            "@type": "Person",
            "name": "Some dude's name"
        },
        "reservationFor": {
            "@type": "Event",
            "name": "Demo Event Flux (1)",
            "startDate": "2022-05-07T22:00:00+10:00",
            "endDate": "2022-05-08T03:00:00+10:00",
            "url": "https://www.yyy.zzz/event/demo-event-fl-1",
            "location": {
                "@type": "Place",
                "name": "Berlin Central Station",
                "address": {
                    "@type": "PostalAddress",
                    "streetAddress": "Europaplatz 1",
                    "addressLocality": "Berlin",
                    "addressRegion": "Berlin",
                    "postalCode": "10557",
                    "addressCountry": "DE"
                }
            }
        }
    }
</script>

“

我不确定,但是这似乎是日历问题,而不是架构问题。 也许日历没有足够的信息来了解精确的时区? 也许我的conversion依是错误的。

这发生在你身上吗? 谢谢

I've got my Event Card approved and working. The card in Gmail shows the correct time (10pm Berlin, DE) but on the Google calendar it shows as 7am.

When I create the card I convert the date from Berlin to UTC and return the date in ISO 8601 format:

$dt = new \DateTime($dateString, new \DateTimeZone($this->timezone ?? \Phpr::$config->get('TIMEZONE')));
$dt->setTimezone(new \DateTimeZone("UTC"));

return $dt->format("c");

and this is the resulting markup:

<script type="application/ld+json">
    {
        "@context": "http://schema.org",
        "@type": "EventReservation",
        "reservationNumber": "2400071",
        "reservationStatus": "http://schema.org/Confirmed",
        "underName": {
            "@type": "Person",
            "name": "Some dude's name"
        },
        "reservationFor": {
            "@type": "Event",
            "name": "Demo Event Flux (1)",
            "startDate": "2022-05-07T22:00:00+10:00",
            "endDate": "2022-05-08T03:00:00+10:00",
            "url": "https://www.yyy.zzz/event/demo-event-fl-1",
            "location": {
                "@type": "Place",
                "name": "Berlin Central Station",
                "address": {
                    "@type": "PostalAddress",
                    "streetAddress": "Europaplatz 1",
                    "addressLocality": "Berlin",
                    "addressRegion": "Berlin",
                    "postalCode": "10557",
                    "addressCountry": "DE"
                }
            }
        }
    }
</script>

Card in Gmail and Calendar entry

I'm not sure, but seems that this is a Calendar problem, not a schema problem.
Maybe Calendar doesn't have enough information to know the precise timezone?
Maybe my conversion is wrong.

Has this happened to you?
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文