Giter VIP home page Giter VIP logo

Comments (9)

nazar-pc avatar nazar-pc commented on May 30, 2024

Wait, but 10.02.2015 is not last date of February, it was current day at the moment of writing.
Can you clarify what you mean?

from pickmeup.

Nadoedalo avatar Nadoedalo commented on May 30, 2024

It's the last day that can be selected to form a report, I place current date as max date.

Остальное-то всё понятно или тоже разъяснить? Просто писать на русском нехорошо т.к эти вопросы-ответы не будут потом гуглится.

from pickmeup.

nazar-pc avatar nazar-pc commented on May 30, 2024

Well, this is very easy to achieve with change event:

...
        change  : function () {
            $(this).pickmeup('set_date', [$(this).pickmeup('get_date')[0], new Date]);
        }
...

Demo: http://jsfiddle.net/z4fmvuzb/32/

from pickmeup.

Nadoedalo avatar Nadoedalo commented on May 30, 2024

Seems laggy and not working correctly... Looks like recursive change event.
http://jsfiddle.net/jz0xq9Lf/8/
The second date has always 1st of current month, want - max date(i.e 31,30,29/28) or the current day from the current month(for now it is 11)

from pickmeup.

nazar-pc avatar nazar-pc commented on May 30, 2024

The second date has always 1st of current month

Wrong, first day of second selected month.

want - max date(i.e 31,30,29/28) or the current day from the current month(for now it is 11)

Will this help?:

date.addMonths(1);
date.addDays(-1);
if (date > max_date) {
  date = max_date;
}

Use this in callback before output, or patch internal options.date before calling get_date method (I personally do not recommend this to avoid any further issues).
Also $('.range').data('pickmeup-options').format in demo makes no sense, because current format assumed by default.

from pickmeup.

Nadoedalo avatar Nadoedalo commented on May 30, 2024

Also $('.range').data('pickmeup-options').format in demo makes no sense, because current format assumed by default.

Wrong, data will be different from formated because by default it returns the original date object
http://jsfiddle.net/jz0xq9Lf/11/

Wrong, first day of second selected month.

Yeah, the second date will be always 1st, so when you select only one month you will select 01-01-2015 to 01-01-2015, not 01-01-2015 to 31-01-2015 as it is expected.

I'm not calling "get_date"(exept of after initialize, and it is OK to have only one date of today), I'm changing inputs by change callback.

from pickmeup.

nazar-pc avatar nazar-pc commented on May 30, 2024

Wrong, data will be different from formated because by default it returns the original date object
http://jsfiddle.net/jz0xq9Lf/11/

Yeah, sorry, you have to put true here to use default format

I'm not calling "get_date"(exept of after initialize, and it is OK to have only one date of today), I'm changing inputs by change callback.

So, you can modify second date in change event, right?

from pickmeup.

Nadoedalo avatar Nadoedalo commented on May 30, 2024

done with changing the callback for periods - now it modyfies the second date, but isn't formatting as the widget(so it is hardcoded)

 changeDatePeriod : function(dates, datesObj){ //fixme должен быть задан формат в зависимости от того который в календаре указан
            var sdo = datesObj[1],
                sd;
            sdo.addMonths(1);
            sdo.addDays(-1);
            sd = sdo.getFullYear()+'-'+('00'+(sdo.getMonth()+1)).slice(-2)+'-'+('00'+(sdo.getDate())).slice(-2);
            dates[1] = sd;
            this.changeDate(dates);
        }

it might be usefull if callback had the 3d argument as this to pickMeUp instance or at least had "format date obj" function

from pickmeup.

nazar-pc avatar nazar-pc commented on May 30, 2024

Is your problem fixed now and we can close this issue?

In fact, I'm not currently actively using this plugin. It inherited most of structure and inner code from original datepicker by Stefan Petre, and it can be much better (events be like normal DOM events with multiple callbacks if needed, better inner structure, probably, more optima, etc.), but I do not have much time for that right now.

from pickmeup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.