Welcome, Guest
Username: Password: Remember me

TOPIC: [FIXED] Help with date please

Help with date please 30 Sep 2013 18:30 #11271

  • twev
  • twev's Avatar
  • Offline
  • Senior Member
  • Posts: 62
  • Thank you received: 15
  • Karma: 6
I want a date field in the format dd-mm-yyyy that can be set by the user and later cleared by the user.

I have tried using the Date field type but I can't get it to work using dd-mm-yyyy. Using this format the date is not changed when saved. (It works OK using yyyy-mm-dd). I am not using the Unix format as I understand that a blank Unix date is not valid.

I have tried setting the format in the field and on the form but cannot find a combination that works.

Any help please?

I am testing in the sandbox using Joomla 3

Thanks
Trevor
The administrator has disabled public write access.

Help with date please 02 Oct 2013 19:48 #11284

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Strange. It is working for me.
Tests are complex because it can depends of many things.

1. What type are you using ? Date, Time, Datetime ?
2. Witch PTL ? Project Table Layout
3. Are you using another date with opposite format : mm-dd-yyyy

Because the component is decoding the string format and when you are using both dd-mm-yyyy AND mm-dd-yyyy it can conflicts because it cannot make difference between the 2 formated strings.

I wll check you project.

Dates are complex when multiples formats are used in the same component.
In future I want to reduce to only ONE date format for whole component and translatable in language file.
Coding is now a piece of cake
The administrator has disabled public write access.

Help with date please 03 Oct 2013 10:33 #11294

  • twev
  • twev's Avatar
  • Offline
  • Senior Member
  • Posts: 62
  • Thank you received: 15
  • Karma: 6
I have created a simple demo project called Date Test. There are two Date fields:
default_format which has the date format left as Inherit
ddmmyyyy_format which has the format set to dd-mm-yyy

I have a form using the two fields and the format of the fields are Inherit. When a date is selected only the data in the default_format is saved. No errors are displayed.

I have tried several combinations and formats but without success so far - I think I am missing something :-))

Trevor
Last Edit: 03 Oct 2013 10:34 by twev.
The administrator has disabled public write access.

Help with date please 10 Oct 2013 00:02 #11359

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Fixed.

Changed files :
concerned models : save() function
helpers / dates.php : getSqlDate() improved
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: twev
Time to create page: 0.062 seconds

Get Started