Giter Site home page Giter Site logo

Comments (8)

luigi37 avatar luigi37 commented on July 23, 2024

+1 here. Only difference is that I would need to disable dates after actual date... In add to not being able to click, user should also not be able to move months forward (or backward in previous case)...

from jqm-calendar.

jwgmeligmeyling avatar jwgmeligmeyling commented on July 23, 2024

Create a function "isDisabled()" which takes a date an returns a boolean. Create a default implementation in defaults thats returns false: function() { return false; }. If you need an other implementation, provide it through settings: { isDisabled: function(date) { return date.valueOf() < (new Date()).valueOf(); }}. Then adjust the cell renderer to set: $element.attr("disabled", options.isDisabled(curDate).

When done, please create a PR.

from jqm-calendar.

ikennah avatar ikennah commented on July 23, 2024

Now I've time to start looking at this, I am not sure I follow the last section Then adjust the cell renderer to set: $element.attr("disabled", options.isDisabled(curDate). can you elaborate

from jqm-calendar.

jwgmeligmeyling avatar jwgmeligmeyling commented on July 23, 2024

That should work!

from jqm-calendar.

ikennah avatar ikennah commented on July 23, 2024

This is what I added, but obviously I am missing something. not working.

  function isDisabled(date){
    return date.valueOf() < (new Date()).valueOf();  
  }

   //Disabling the elements
  $element.attr('disabled', options.isDisabled(curDate));

from jqm-calendar.

luigi37 avatar luigi37 commented on July 23, 2024

Updated code. Can someone check if it works properly?

from jqm-calendar.

luigi37 avatar luigi37 commented on July 23, 2024

hmmm... the option 0 (don't disable dates) and -1 (disable past dates) seems to work properly in the latest code.
For some reason the option 1 (disable future dates) once moving to next month still show available first week... not sure why...

from jqm-calendar.

luigi37 avatar luigi37 commented on July 23, 2024

Ok solved (my mistake in dateOnly function)

from jqm-calendar.

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.