Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

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

  • twev
  • twev's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 62
  • Thank you received: 15
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

Please Log in or Create an account to join the conversation.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

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

  • twev
  • twev's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 62
  • Thank you received: 15
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

Please Log in or Create an account to join the conversation.

Last edit: by twev.

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

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

Changed files :
concerned models : save() function
helpers / dates.php : getSqlDate() improved
Coding is now a piece of cake
The following user(s) said Thank You: twev

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.060 seconds

The j-cook project is one of the best of its kind and it is nice that we all try to contribute in little ways to make life easy for each other.

vlemos (Forum)  

Get Started