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

Form submission times are incorrect in the CP #1359

Closed
dannyuk1982 opened this Issue Mar 29, 2017 · 12 comments

Comments

Projects
None yet
2 participants
@dannyuk1982

dannyuk1982 commented Mar 29, 2017

Form submissions are saved with a timestamp, that timestamp isn't correctly displayed in the CV, it's always a seemingly random hour, followed by 03 as the minutes,

i.e. for these submissions

screen shot 2017-03-29 at 14 49 59

Their timestamps should be converted to i.e. 12:14:18, 12:24:18, 12:24:35 etc. but they are in fact all 13:03 in the CP.

Setup:
OS X, MAMP, Apache, PHP 7.1, Statamic 2.5.7

@jasonvarga

This comment has been minimized.

Show comment
Hide comment
@jasonvarga

jasonvarga Mar 29, 2017

Member

Let's see your formset yaml file, and your site/setting/cp.yaml file.

Member

jasonvarga commented Mar 29, 2017

Let's see your formset yaml file, and your site/setting/cp.yaml file.

@dannyuk1982

This comment has been minimized.

Show comment
Hide comment
@dannyuk1982

dannyuk1982 Mar 29, 2017

It's doing it on all forms, here is one formset:

prize-draw.yaml

honeypot: f_company
fields:
  f_first_name:
    display: First name
    validate: required|min:1
  f_last_name:
    display: Last name
    validate: required|min:1
  f_email:
    display: Email
    validate: required|email
  f_date_of_birth:
    display: Date of birth
    validate: required|date_format:d/m/Y
  f_accepted:
    display: Accepted
    validate: required
  f_branch:
    display: Branch
    validate: required|min:1
columns:
  - f_first_name
  - f_last_name
  - f_email
  - f_date_of_birth
  - f_branch

site/setting/cp.yaml file:

date_format: Y/n/d
pagination_size: 25
widgets:
  -
    type: collection
    collection: offer
    limit: 5
    width: 50
  -
    type: collection
    collection: blog
    limit: 5
    width: 50
  -
    type: collection
    collection: restaurant
    limit: 5
    width: 50
  -
    type: collection
    collection: menu-items
    limit: 5
    width: 50
  -
    type: PowerTools
    width: 100

dannyuk1982 commented Mar 29, 2017

It's doing it on all forms, here is one formset:

prize-draw.yaml

honeypot: f_company
fields:
  f_first_name:
    display: First name
    validate: required|min:1
  f_last_name:
    display: Last name
    validate: required|min:1
  f_email:
    display: Email
    validate: required|email
  f_date_of_birth:
    display: Date of birth
    validate: required|date_format:d/m/Y
  f_accepted:
    display: Accepted
    validate: required
  f_branch:
    display: Branch
    validate: required|min:1
columns:
  - f_first_name
  - f_last_name
  - f_email
  - f_date_of_birth
  - f_branch

site/setting/cp.yaml file:

date_format: Y/n/d
pagination_size: 25
widgets:
  -
    type: collection
    collection: offer
    limit: 5
    width: 50
  -
    type: collection
    collection: blog
    limit: 5
    width: 50
  -
    type: collection
    collection: restaurant
    limit: 5
    width: 50
  -
    type: collection
    collection: menu-items
    limit: 5
    width: 50
  -
    type: PowerTools
    width: 100
@jasonvarga

This comment has been minimized.

Show comment
Hide comment
@jasonvarga

jasonvarga Mar 29, 2017

Member

Actually...

Fixed for next release. We were hardcoding the minutes. But it wasn't minutes. It was the month.

The patch, if you want to fix it now is this.
image

It goes in statamic/core/Forms/Submission.php
$this->form()->dateFormat() for your copy/pasting pleasure.

Now it'll use the date format you've specified, as it should have done anyway.

Member

jasonvarga commented Mar 29, 2017

Actually...

Fixed for next release. We were hardcoding the minutes. But it wasn't minutes. It was the month.

The patch, if you want to fix it now is this.
image

It goes in statamic/core/Forms/Submission.php
$this->form()->dateFormat() for your copy/pasting pleasure.

Now it'll use the date format you've specified, as it should have done anyway.

@dannyuk1982

This comment has been minimized.

Show comment
Hide comment
@dannyuk1982

dannyuk1982 Mar 29, 2017

I have done that many a time with PHP date params, they are confusing! Cheers :)

dannyuk1982 commented Mar 29, 2017

I have done that many a time with PHP date params, they are confusing! Cheers :)

@dannyuk1982

This comment has been minimized.

Show comment
Hide comment
@dannyuk1982

dannyuk1982 Mar 29, 2017

This is a better fix, as it keeps the time in, can you please implement this instead?

$this->formset()->get('date_format', 'Y-m-d H:i')

dannyuk1982 commented Mar 29, 2017

This is a better fix, as it keeps the time in, can you please implement this instead?

$this->formset()->get('date_format', 'Y-m-d H:i')

@jasonvarga

This comment has been minimized.

Show comment
Hide comment
@jasonvarga

jasonvarga Mar 29, 2017

Member

Put the time in your date_format

Member

jasonvarga commented Mar 29, 2017

Put the time in your date_format

@dannyuk1982

This comment has been minimized.

Show comment
Hide comment
@dannyuk1982

dannyuk1982 Mar 29, 2017

oh, in site settings - ok... what else will that affect?

dannyuk1982 commented Mar 29, 2017

oh, in site settings - ok... what else will that affect?

@jasonvarga

This comment has been minimized.

Show comment
Hide comment
@jasonvarga

jasonvarga Mar 29, 2017

Member

You can put it in your formset though.

Member

jasonvarga commented Mar 29, 2017

You can put it in your formset though.

@dannyuk1982

This comment has been minimized.

Show comment
Hide comment
@dannyuk1982

dannyuk1982 Mar 29, 2017

Ah cool, and this is the point where I moan about I couldn't see that in the docs :)

dannyuk1982 commented Mar 29, 2017

Ah cool, and this is the point where I moan about I couldn't see that in the docs :)

@jasonvarga

This comment has been minimized.

Show comment
Hide comment
@jasonvarga

jasonvarga Mar 29, 2017

Member

You can moan some more because it's not in the CP either. ;)

Member

jasonvarga commented Mar 29, 2017

You can moan some more because it's not in the CP either. ;)

@dannyuk1982

This comment has been minimized.

Show comment
Hide comment
@dannyuk1982

dannyuk1982 Mar 29, 2017

A double moan with whipped cream coming right up!

dannyuk1982 commented Mar 29, 2017

A double moan with whipped cream coming right up!

@jasonvarga

This comment has been minimized.

Show comment
Hide comment
@jasonvarga
Member

jasonvarga commented Mar 29, 2017

@jasonvarga jasonvarga closed this Apr 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment