Skip to content

Unusual behavior with 2 calendar_date_select_tags #7

Closed
davfrija opened this Issue Jun 25, 2010 · 2 comments

1 participant

@davfrija

Hi, really nice plugin.

I was check a really unusual behavior with the following code:

<%= label_tag I18n.t('activerecord.reports.dates') %> <%= calendar_date_select_tag "begin_date", params[:begin_date], :year_range => 3.years.ago..3.years.from_now, :popup => :force%> <%= label_tag I18n.t('activerecord.reports.date_and') %> <%= calendar_date_select_tag "end_date", params[:end_date], :year_range => 3.years.ago..3.years.from_now, :popup => :force %>

In the first calendar (begin_date) select a month and a day, let's say 2010-06-01, next in the second calendar (end_date) i can select june again, but when select a day it will get the next month. In the date preview the month 6 desapear, it show 2010-05-31 and next day is 2010-07-01 =(



I'm running rails 2.3.8 with firefox 3.6.3 (ubuntu) with CalendarDateSelect version 1.16.1. and with <%= calendar_date_select_includes nil, :locale=>'pt' %> in the form.



Cheers,

@davfrija

Well, this bug was really unusual =)
There were more parameters that imports than those I had reported =(, the values where initialized with begin_date='2010-01-01' and end_date='2010-12-31'.
So, when on end_date we select june, and june don't have 31 days the calendar show july =|
We correct the default behavior by changing the order off set date like the following:
on updateSelectedDate: ...
first -> t_selected_date.setDate(parts.get("day"));
then ->t_selected_date.setMonth(parts.get("month"));
...

on dayHover: ...
first -> hover_date.setDate(element.day);
then -> hover_date.setMonth(element.month);
...

bye

@davfrija

resolved =)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.