Search

Hi,

I have an unsolved issue concerning inserting date :/ I have changed date_format to d/m/Y on manifest/config.php but the value inserted/updated on frontend/backend keeps switching day and months, I haven't found anywhere on code or database where to change it.

any way to solve this ?

Anyone can help ?

Can you explain what field you're using, how you're inputting the data, how it's being stored, and how/where it's being displayed?

I repeat with more details : date_format set to d/m/Y on manifest/config.php

first test :

  • using backend
  • creating new entry on any section containg Date Field
  • typing on a Date Field 05/03/2011 00:00
  • save entry
  • result on saved entry : 03/05/2011 00:00
  • result on section's entries : 03/05/2011 00:00

second test :

  • still using backend
  • editing same entry
  • I find value 03/05/2011 00:00
  • I save again without changing anything
  • result on saved entry : 05/03/2011 00:00
  • result on section's entries : 05/03/2011 00:00

third test :

  • using frontend form through an event
  • I put on birthday field value 08/01/2011
  • the result seen on backend is 01/08/2011 00:00
  • and the following code is the confirmation that what I have wrote is what was sent through event :

    create-player id="90" result="success" type="created"
      message Entry created successfully. message
       post-values 
         login  test10  login 
         pass  test10  pass>
         email  test10@test10.com  email
         birthday  08/01/2011  birthday
         enabled  no  enabled
       post-values
    create-player

conclusion : that's what is called "switches month and day" everytime saved.

the bug doesn't happend when using the standard formats from previous symphony version.

on symphony 2.2 d/m/Y and m.d.Y doesn't work maybe this bug happened cos those formats were not present on installation date format listing of symphony 2.12

and as I'm new on symphony (less than one month) it's a nightmare to start debuging an unknown code.

I think this problem is caused by PHP's strtotime() function which always expects american date formats like m/d/Y. This should be considered as a bug of the date field where we should compare the date with the system settings first using DateTime::format and only pass it through strtotime() if DateTime::format returned false.

I'll fill this as a bug on the issue tracker.

Aliminium, could you please have a look at my proposed change to Lang::standardizeDate() and see if this fixes your issue? Thanks!

http://getsymphony.com/discuss/issues/view/584/#position-4

I don't know if it will fix the issue, I need it to be integrated to symphony to test it :)

Well, you could just replace the function in your install :)

I've tested your standardizeDate Nils since i was having a similar issue (diferent date formats at backend). Now all dates display as i set in manifest. In the xml output the dates have a diferent format than in the backend tho.

I will test it more deeply. Thanks

Btw, first post. Hello!

Welcome Guillermo and thanks for testing this out.

I created a new branch datetime on by fork of Symphony which improves the date and time handling and moves it to its correct place in lib/core/class.datetimeobj.php. Have a look at https://github.com/nilshoerrmann/symphony-2/tree/datetime.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details