google-code-export / calendardateselect

Automatically exported from code.google.com/p/calendardateselect
Other
0 stars 0 forks source link

Add option to set the default hour / minute of the picker (rather than using the current time) #103

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
set a default time for new dates, for example calendar would default to 5pm
instead of current time.

something like this would be nice:

<%= calendar_date_select :mode, :due_date,
:default_hour=>"17",:default_minute=>"0" %>

Original issue reported on code.google.com by printabl...@gmail.com on 11 Apr 2008 at 2:36

GoogleCodeExporter commented 9 years ago
sorry, this isn't a defect.

Original comment by printabl...@gmail.com on 11 Apr 2008 at 2:46

GoogleCodeExporter commented 9 years ago
This is a good idea - setting the time to "now" isn't very helpful.  It could 
likely be accomplished with a single 
default Date/Time option.

Original comment by timchar...@gmail.com on 18 May 2008 at 3:01

GoogleCodeExporter commented 9 years ago
Here is how we have tweaked calendar_date_select to use default_hour and 
default_min :

in vendor/plugins/calendar_date_select/lib/calendar_date_select.rb
in calendar_date_select_process_options(options)
add : :default_hour, :default_min to the key list (line 116)

in the calendar_date_select.js file
in parseDate
replace :
    if (isNaN(this.date)) { this.date = new Date(); }
by :
    if (isNaN(this.date))
    {
        this.date = new Date();
        if(this.options.get("default_hour")) {
          this.date.setHours(this.options.get("default_hour"));
          this.date.setMinutes(0);
        }
        if(this.options.get("default_min")) {
          this.date.setMinutes(this.options.get("default_min"));
        }
    }

Original comment by Raphael.Emourgeon on 9 Nov 2008 at 2:23

GoogleCodeExporter commented 9 years ago

Original comment by timchar...@gmail.com on 30 Nov 2008 at 8:28

GoogleCodeExporter commented 9 years ago
Related issue: #125

Original comment by timchar...@gmail.com on 30 Nov 2008 at 8:37

GoogleCodeExporter commented 9 years ago
Added to release 1.16.

Original comment by shih....@gmail.com on 1 Apr 2010 at 12:58