xdan / datetimepicker

jQuery Plugin Date and Time Picker
https://xdsoft.net/jqplugins/datetimepicker/
MIT License
3.5k stars 1.52k forks source link

Load the datepicker to the current date in the input #17

Open CR41G14 opened 10 years ago

CR41G14 commented 10 years ago

Hi

I have an input with a date in the future in the format dd/MM/yyyy hh:mm:ss (31/12/2014 12:00:00).

When I load the datetimepicker I want it to default to the current date, both the date and time. Is this possible? Currently it is showing today's date only,

I can see that you have a validate date function and this is returning and object of date so not sure why it is defaulting to today.

Thanks

jamesfholland commented 10 years ago

Did you ever find a solution to this?

CR41G14 commented 10 years ago

Unfortunately no

Sent from my iPhone

On 29 Mar 2014, at 00:38, James Holland notifications@github.com wrote:

Did you ever find a solution to this?

— Reply to this email directly or view it on GitHub.

jdelibas commented 9 years ago

Try this.

            $(element).datetimepicker({
              format         : 'd/m/Y H:i',
              formatTime     : 'H:i',
              formatDate     : 'd/m/Y',
              defaultDate    : '31/12/2014',
              defaultTime    : '12:00'
            });
ghost commented 9 years ago

This bug may have been fixed. I know that I fixed the bug when it related to day of year dates (YYYY-z or 2014-219). But I haven't looked at this project since I got my code working.

Day of year was not setting the the correct date because it failed to parse existing values correctly. I suspect that changing the format to dd/MM/yyyy may not parse either.

This commit should show some information on my solution to a similiar problem 1a3fd7d238b4e3095b70835a93307ef36423033d