Git Product home page Git Product logo

datepicker's Introduction

Yet Another Datepicker

An attempt at writing a flexible, framework free, feature-rich and accessible datepicker.

At a glance…

  • Keyboard shortcuts adhere to The DHTML Style Guide Working Group (DSGWG) recommendations
  • Accessibility enhancements including support for ARIA Roles and States
  • The script can parse and format dates using a subset of the PHP date conversion specifiers
  • Both upper and lower date limits can be set
  • Bespoke days of the week can be disabled
  • Bespoke dates can be disabled/enabled and “*” wildcards used to stipulate the dates in question
  • Bespoke days of the week can be highlighted
  • Works with any combination of text inputs or select lists
  • DOM friendly – the datepicker is only added to the DOM when actually required
  • Includes a “smart localisation” option and has been translated into many languages
  • Can display an optional status bar and week numbers
  • Can be dragged within the viewport by the user
  • Global configuration parameters can be specified using JSON within the script tag itself
  • The “button” used for popup datepickers can now be styled for default, hover, focus, active and disabled states, be arbitrarily positioned within the DOM and removed from the document tabindex if so desired
  • Inline datepickers are now available, are automatically added to the document tabindex and can be arbitrarily positioned within the DOM
  • A bespoke final opacity can be defined and if desired, the fade in/out animation effect disabled
  • The entire U.I. grid can now be filled with dates
  • The “Today” button can be removed from the U.I.
  • Fully skinnable with CSS
  • Compatible down to IE6

Demo & Documentation

A comprehensive demo and full documentation is available.

datepicker's People

Contributors

dave-irvine avatar dkeeghan avatar freqdec avatar phillipkoebbe avatar tjgrathwell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

datepicker's Issues

JAWS not allowing keyboard control of the datepicker

While JAWS is running, the datepicker is not controllable via keyboard. I see that you applied role=application to the div and role=grid to the table and I'm not sure if one is overriding the other but it appears that the application role isn't being respected in order to release the control of the screen reader. The problem seems to be present in the latest version of JAWS and NVDA.

If it helps, here is a demo of a datepicker that works with JAWS:
http://whatsock.com/tsg/Coding%20Arena/ARIA%20Date%20Pickers/ARIA%20Date%20Picker%20(Basic)/demo.htm

And some explanation of some details of the tag nuances:
http://whatsock.com/training

binding datePicker

Is there any way to bind the datePicker to any new .date_picker elements added to the dom? Thanks!

Timing of dateset callback

This isn't so much an issue as an inquiry. I searched for an email address for you but didn't find one. Either I didn't search hard/long enough (highly likely), or you don't want to have emails sent directly to you (quite possible, which is fine...just acknowledging the possibilities).

I've noticed that when my dateset callback is called, the associated form element has not yet had its value updated. I looked at the code, and I see that you are calling the dateset callback right before returnFormattedDate, which is where the value gets updated. I'm wondering if it would make more sense to call the dateset callback after updating the value in returnFormattedDate.

I do see, however, there is one time you call the dateset callback without calling returnFormattedDate (in changeHandler) and one time you call returnFormattedDate without calling the dateset callback (in setDateFromInput). Will you shed some light on the reasoning?

Beyond that, is it possible for datePicker to fire the associated form element's change event after updating it? That would really solve my problem and possibly be the right behavior.

IE7/8 Focus issue when input is hidden

If an input is hidden via display:none in IE7/8 and you try to give it focus, IE will through a "Can't move focus to the control..." error. So, I've changed the fd-hidden-input class to fd-screen-reader and all is fine.

That said, any recommendations on the best way to handle a user tabbing into that hidden input and forcing them to use the datepicker?

Abstract element selector

I am working on an application that dynamically generates forms and would like to pass the DOM node into the constructor instead of an element ID, or perhaps even an class name.

Datepicker on modalbox

Seems I stumbled upon an error by accident. First I loaded a form on a modalBox(jqueryUI), then cancel/close the form, then load again the form on the modalBox, click the datepicker icon, error encountered.

"TypeError: this.div is undefined"

Navigation Controls(Prev or Next) does not change date some of the times

Hi,

I have been using this plugin in one of my projects. I appreciate the good work!
Although, I am having an issue with the date picker i.e. when user uses datepicker's navigation buttons for changing year or month, some of the times they do not respond well.

This issue is occuring on majority of browsers including IE9, FF and Chrome although its intermittent.

Findings: When user clicks on a "Prev-Month" button, I have noticed that few events/handlers are triggered : mousedown, updateTable and click handler in the same order. When the navigation does not respond in that case I observed that only click handler was getting invoked.

Any idea....?

Update: This is happening library is not able to bind the events to the control when control has any special character in its "id" attribute.

no copy of MIT license in repo

Hi, MIT licensing requires that a copy of the license be included with the software. Could you please add one? Thanks!

Allow formElements to be inputs with type `number`

Is it possible to include inputs with type="number" as allowable fields to bind the date picker too?

Our use-case is HTML5 based content where a date is being collected with the day and year fields as inputs with type number for keyboard selection on mobile devices, rather than the default text keyboard.

You can't select 21th october

I will try to understand why but if you select 21th october the calendar picks the 20th and overwrite the calendar.

Marco

Safari fires an error

The error that I have on Safari 6.0.5 desktop and iOS 7 mobile Safari :

TypeError: Attempted to assign to readonly property. on line 144.
No error in Chrome or Safari on the same thing.

Documentation mistake

In "Setting status bar messages dynamically" it says

datepickerController.setBespokeTitles("inp1", {
  ...
});

but it should be

datePickerController.setBespokeTitles("inp1", {
  ...
});

(uppercase P in datePicker)

Autoformatting changes the format

If I set the format to %d-%m-%Y and type 01-04-2001 or 01 04 2001, the date stays/is converted to 01-04-2001.
However, if I type 01 04 01 or 01-04-01, the format is changed to %m-d%-%Y and I end up with 04-01-2001

disable dates on select

Hi there,

wonderful work!

I wonder if there's a way to set disabled or enabled days of a second datepicker on firing an onselect event of a first datepicker. I'm coding sort of a booking form with datepickers for start and end of the booking request. Already booked dates are disabled by using setDisabledDates. The idea is to set all dates of the end date picker to disabled at first page load and enable dates dependend on the selection in the first datepicker. Otherwise users can select end dates past to the next booked out period...

Any idea?

thx in advance // nielo

Error on next and previous month click

I'm getting the following error in IE8 when I click on the next or previous buttons of the date picker.

Unable to get property 'target' of undefined or null reference

This relates to the following part of the library:

this.onclick = function(e) {
if((!cssAnimations && o.opacity != o.opacityTo) || o.disabled || e.target.className.indexOf('not-available') != -1) {
return stopEvent(e);
};

textbox onclick/onfocus to popup datepicker

I want the datepicker to pop up as soon as the text box gets focus or is clicked. Could you please let me know? I have gone through the js file and tried several settings. Nothing seems to work. TIA

console in IE8

Lines 589 and 590 cause errors in IE8 due to use of console.log

Contact

Looking to get a way to contact you to license.

Thanks.

Passing dynamic element ID's to datePicker

I'm trying to create a datePicker calendar instance based on a dynamic element ID from a jQuery cloned table row. $clTRow is the cloned row:
$clTRow.find("a").each(function(){
var orig = (this.id.match(/\d+$/) || [0])[0];
var num = +(this.id.match(/\d+$/) || [0])[0] + 1;
var inputName = "sf215Date_" + orig + "" + num;
var inputTitle = "SF215 Date " + orig + "
" + num;

                this.id = this.id.replace(/\d+$/, "") + orig + "_" +num ;
                this.href = this.href.replace(this.href, "") +  "#" + $clTRow.find('input[id^="sf215Date_"]').attr('id');
                this.title = this.title.replace(this.title, "") + inputTitle;

/*when I try to create the option string dynamicly it places quotes around the string which I believe invaidates it. */
var opts = '{formElements:{'+ inputName + ': "m-sl-d-sl-Y"},calendarIconTitle :' + inputTitle + '};';

/* if I put the variable name in it takes it as a string literal */
var opts = {formElements:{inputName : "m-sl-d-sl-Y"},calendarIconTitle :inputTitle };

/* if I use eval() around the var name, it tells me that I'm missing a semi colon*/
var opts = {formElements:{eval("inputName") : "m-sl-d-sl-Y"},calendarIconTitle :eval ("inputTitle")};

datePickerController.createDatePicker(opts);

            });

Is there any way to pass in a dynamicly generated ID and Title.?

CSS - avoid having to manually fix CSS file

Currently the CSS file asks developers to find/replace the URL path to the media directory.

Can this just be ../media/ in the CSS file as supplied?

This also avoids upgrades wiping the fixed URLs.

-- Tim.

After Popup is hidden it Stays Active in the UI on IE11

On IE11, after datePicker popup is shown and then hidden (by clicking elsewhere), the hidden popup is still active even though it is invisible. It still controls the cursor and still flashes messages as the cursor moves over (invisible) dates. Controls that are "under" the hidden datePicker are inaccessible.
The problem occurs on Internet Explorer 11. I have tried it on Firefox, Chrome and Safari and they do not exhibit the problem.

Windows 7 64bit
IE 11.0.9600.17420

add possibility to select multiple dates

Hi,

Is it possible to select multiple dates?
So instead of a SelectedDate property you would have a list of selected dates.
Would this be hard to implement? If not, can you point me in a direction?

Thanks!

Arne

Hover indicator is more prominent than selection

This is bad UI in general as the hovered-over date appears to be the selected date when in fact it is not. You could easily just swap the visual styles of selected vs hover to resolve this.

No keyboard controls in IE10

I have found that when using IE10, the user is only able to open the calendar but cannot navigate via keyboard. I was able to reproduce the same issue on the plugin examples. Is this a known issue?

TimePicker

Hello,

Can you add a option to create a timePicker (just two input element under the table) with the datePicker ?

Thank you.

Bower Import?

Would it be possible for you to create a http://bower.io/ registry and package for this library I find it useful and it would be cool to import via bower into a SPA.

Thanks,

Lang file configuration

I'd like to propose the following (happy to develop this if you are happy?):

  • deriveLocale should be completely optional (an option that you can pass into createDatePicker), if set to false - then no attempt is made to load a file from lang/
  • It should be possible to specify the location of lang files, if not located in the same location as datePicker itself.

Cannot keyboard navigate with NVDA running

Control works fine in Chrome, I can tab in, hit ENTER to open the control, move around with arrows and select a date with ENTER. Attempt exactly the same behaviour with NVDA running and I can open with ENTER but the arrow keys don't work, I can't select a date.

Obviously, this is a critical issue.

I'm guessing NVDA is intercepting the arrow keys for navigation on the page. Looking in to how to fix this, if anyone has any suggestions feel free to weigh in.

disable next week

I am using datePicker v4.4and having trouble in disabling present date and dates after 7days from today. here's the link of my work. please help

package.json

Hello. I'd be grateful if you could add a package.json file so that your datePicker could be used as an NPM dependency .

Auto formatting of dates wont work with some date ranges.

First of all, I am using version 5.4 because 6.2 doesn't auto format at all. But with 5.4, certain date ranges won't auto format, such as the following:

January 1-29
Any month, days 1-2
So, if I enter 1302012, it will format to 01/30/2012 but if I enter 1292012, it will stay 1292012. For the rest of the months, if I enter 212012 it will stay that way, but if I enter, 232012, it will format to 02/03/2012.

I am using JQuery 1.8.2

Thanks

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.