nazar-pc / PickMeUp

Really simple, powerful, customizable and lightweight standalone datepicker
BSD Zero Clause License
615 stars 191 forks source link

pickmeup isn't read the date passed as objects? #177

Closed majioa closed 6 years ago

majioa commented 7 years ago

I have the code, which I add some hours to the current date in:

   date = new Date();
   date.setTime(date.getTime() + 3 * 60 * 60 * 1000);
   current = new Date();
   current.setTime(current.getTime() + 4 * 60 * 60 * 1000);
   pickmeup('#calendar', {
      date: date, // plus 3 hours
      current: current // plus 4 hours
   }).show();

In a debugger I see that the dates are being changed, but the dates on the calendary are the same (defaulting to now). So why the pickmeup isn't read the date passed as objects?

nazar-pc commented 7 years ago

Why shouldn't dates be the same? PickMeUp doesn't care about hours, only about days, months and years. Also hours will not be preserved internally, so do not rely on that.

To be honest, I don't understand what you're trying to achieve and what issue you're facing.

majioa commented 7 years ago

@nazar-pc Of course PickMeUp doesn't care about hours, but when a date was passed to date field as an argument the lib just ignore the whole datetime with a date part defaulting to Date.now .

nazar-pc commented 7 years ago

Hm... could you prepare a demo? https://github.com/nazar-pc/PickMeUp#contribution

majioa commented 7 years ago

will try