Skip to content

Collection entry timestamps in CP lists are ignoring app timezone setting #5748

Description

@joseph-d

Bug description

I created a new collection called Tests with a blueprint which contains a time-enabled date field called updated_at.

Creating an entry within this collection just now produces a timestamp of 1649151537 which is equal to 2022-04-05 09:38:57 UTC. In the collection list, this shows as 2022-04-05 09:38 as follows:

Screenshot_20220405_104237

However, because my config/app.php is set with 'timezone' => 'Europe/London', (which is UTC+1) I would expect this to show in the collection list as 2022-04-05 10:38

Indeed, running Carbon::now() outputs 2022-04-05 10:39:19.161282 Europe/London (+01:00) because it's taking the timezone setting in config/app.php into account and obviously a minute has passed since I wrote the above 2 paragraphs.

How to reproduce

  1. Create this collection:
title: Tests
revisions: false
date_behavior:
  past: public
  future: private
  1. Create this blueprint:
sections:
  main:
    display: Main
    fields:
      -
        handle: title
        field:
          type: text
          required: true
          validate:
            - required
      -
        handle: updated_at
        field:
          mode: single
          time_enabled: true
          time_seconds_enabled: false
          full_width: false
          inline: false
          columns: 1
          rows: 1
          display: 'Updated at'
          type: date
          icon: date
          listable: hidden
          instructions_position: above
          read_only: false
  sidebar:
    display: Sidebar
    fields:
      -
        handle: slug
        field:
          type: slug
          localizable: true
title: Tests
  1. Create an entry in the collection by entering only the title and letting Statamic fill in the updated_at timestamp itself.

  2. View the entry in the list, enabling the Updated at field using the Displayed Columns button

  3. The time displayed under Updated at will be the server time (usually UTC) and will not be taking the Laravel config/app.php timezone setting into account.

Logs

No response

Versions

Statamic 3.3.4 Pro
Laravel 8.83.6
PHP 8.1.4

Installation

Existing Laravel app

Antlers Parser

runtime (new)

Additional details

As far as I'm aware, having the server set on UTC is standard practice so I do not believe I'm doing anything fancy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions