- Issue created by @tehmilcho
- 🇩🇪Germany tehmilcho
Hey... I played bit more around so it seems to work with plane datefield but not when i wanna use a timespan filed with start / end time and date and time.
- 🇩🇪Germany tehmilcho
hey i changed now:
in FlipDownFormatter.php
/** * @FieldFormatter( * id = "flipdown", * label = @Translation("FlipDown countdown"), * field_types = { * "datetime", * "timestamp", * "daterange" * } * ) */
and added "Datarange" and also added "Datarange" in flipdown.views.inc .. now i pick the format in my View it also will show kind of correct .. so JS script is loaded the counter counts etc but the time is off by 2 Hours .. my Server, PHP, Durpal all is set to "Berlin" as timezone but the Module gives back:
UTC Timestamp: 1753822800 (2025-07-29T23:00:00+02:00)
Instead of "2025-07-30T01:00:00+02:00". Unfortunately i dont have real clue about Drupal DEV or PHP .. i just messaround with AI and good luck. Maybe some else can give a hint what is going with the Timezone here?!
- 🇷🇸Serbia levmyshkin Novi Sad, Serbia
I need to investigate this situation with Timezone, it's not clear for me now where is source of truth for timezone. It can be changed on Server, Sitewide, User specific, Field Storage/Instance/Formatter specific.
- 🇩🇪Germany tehmilcho
Hey,
first thank you for looking in to it, i really appreciate it :)
I messed bit more around with AI and found a Soultion?!... its just code from ChatGPT but it seems to work now.
Change:
File: FlipDownFormatter.phpOriginal Code:
// Convert stored value to Unix seconds. if (is_numeric($item->value)) { $target_ts = (int) $item->value; } else { try { $target_ts = (new DrupalDateTime($item->value))->getTimestamp(); } catch (\Exception $e) { continue; } }
Replacement:
try { $timezone = new \DateTimeZone(\Drupal::config('system.date')->get('timezone.default')); if (is_numeric($item->value)) { // Timestamp in seconds → treat as UTC $date = new \DateTime('@' . $item->value); } else { // ISO string or date as string → first interpret in UTC $date = new \DateTime($item->value, new \DateTimeZone('UTC')); } $date->setTimezone($timezone); $target_ts = $date->getTimestamp(); } catch (\Exception $e) { continue; }