Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty 3.1.3 - Problem with html_select_date

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
genh
Smarty n00b


Joined: 20 Oct 2011
Posts: 2

PostPosted: Thu Oct 20, 2011 8:53 am    Post subject: Smarty 3.1.3 - Problem with html_select_date Reply with quote

Hi,

I have a problem with html_select_date plugin.

I want to have an empty date selected but it's impossible with Smarty 3.1.3.

It worked with Smarty 3.0.8.

My template code is:


{html_select_date field_array="field" prefix="" field_order="DMY" start_year="1980" reverse_years="1" day_value_format="%02d" all_empty="--" time="--"}

With Smarty 3.1.3, it displays the current date.
With Smarty 3.0.8, it displayed "--" for each field.

Cordially.
genh
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Thu Oct 20, 2011 1:31 pm    Post subject: Reply with quote

you're right. I fixed this issue in SVN trunk. It will be included in Smarty 3.1.5. Thanks for finding that.
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
genh
Smarty n00b


Joined: 20 Oct 2011
Posts: 2

PostPosted: Thu Oct 20, 2011 1:46 pm    Post subject: Reply with quote

Thank you !


genh
Back to top
View user's profile Send private message
vninja
Smarty n00b


Joined: 24 Oct 2011
Posts: 1

PostPosted: Mon Oct 24, 2011 8:56 pm    Post subject: Reply with quote

Hi rodneyrehm,

I checked out the code in the trunk and the html_select_date is still not working properly.

{html_select_date year_as_text=true time="--" day_value_format="%02d" month_empty="Month" day_empty="Day"}

would still default to the current date. If you change the time to empty string i.e. time= " ", that would not work either. The only way for us to have the default empty value would be taking out the "time" argument, but that would contradict with the description of the "time" argument in the doc. According to the doc, time is an optional argument. If you don't include that into the function, it would default to the current date.

Is it possible to check the "time" argument to see if it's a valid date or not? If it's not a valid date, then it would default to the empty value?

Thanks!
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Tue Oct 25, 2011 6:35 am    Post subject: Reply with quote

pass NULL instead of "--" as the time and you'll get the defaults.
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
dough boy
Smarty Rookie


Joined: 31 Mar 2006
Posts: 32

PostPosted: Fri May 04, 2012 8:38 pm    Post subject: Reply with quote

Sorry to reopen this but some more work might want to be considered. I would pass in a mysql date time (yyyy-mm-dd) and it would work fine. All of a sudden I started getting the current date. I found out it was because I was passing in '0000-00-00'. To me this should be considered the same as NULL.

I then tried time=$date|default:NULL and still got the same thing. I ultimately had to modify my queries to return NULL instead of 0000-00-00.

Food for thought.
Back to top
View user's profile Send private message
JaggedJax
Smarty n00b


Joined: 18 Jul 2012
Posts: 4

PostPosted: Wed Jul 18, 2012 12:54 am    Post subject: Reply with quote

I was expecting '0000-00-00' to act that way as well. It wasn't until I found this thread that I realized it needed to be NULL.

I think that 0000-00-00 should be treated as a blank/null date.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP