Giter Site home page Giter Site logo

mehmetatabey / jquery-date-dropdowns Goto Github PK

View Code? Open in Web Editor NEW

This project forked from icklechris/jquery-date-dropdowns

0.0 1.0 0.0 57 KB

A simple, customisable jQuery datepicker plugin to dynamically generate separate "day", "month" and "year" dropdowns, and provide a formatted date string for form submission

License: MIT License

JavaScript 84.74% HTML 9.40% CSS 5.86%

jquery-date-dropdowns's Introduction

#jQuery Dropdown Datepicker

A simple date select plugin. ####Demo

##Installation ####Bower bower install -S jquery-date-dropdowns

##Usage ####Instantiation

 $("#date_of_birth").dateDropdowns({
     configOption: configValue
 });

The plugin can be initialised either directly on an input field, or on a container element (e.g. a <div>).

####Date Validation The Day dropdown's options change automatically depending on the month selected. If the day value is rendered invalid after the selection of a month (e.g. selecting February when the selected day is 31st) the day dropdown is reset and a class of invalid is applied, remaining until a valid day is selected.

##Configuration Options

####daySuffixes

Type: boolean
Default: true

Indicates whether day numbers should include their suffixes when displayed to the user (e.g. 1st, 2nd, 3rd)

####defaultDate

Type: string
Default: null

Populate the widget with a default date. Use with defaultDateFormat

####defaultDateFormat

Type: string
Default: yyyy-mm-dd
Options: dd/mm/yyyy, mm/dd/yyyy

The format of the date string provided to defaultDate

####displayFormat

Type: string
Default: dmy
Options: myd, ymd

Specify the order in which the dropdown fields should be rendered. Defaults to Day Month Year

####dropdownClass

Type: string
Default: null

Set the class attribute of generated dropdown elements

####maxAge

Type: int
Default: 120

Indicates the maximum age the widget will accept

####maxYear

Type: int
Default: null

The highest year option that will be available. Note: this will take precedence over minAge

####minAge

Type: int
Default: 0

Indicates the minimum age the widget will accept

####minYear

Type: int
Default: null

The lowest year option that will ba available. Note: this will take precedence over maxAge

####monthFormat

Type: string
Default: long
Options: numeric, short

Specify the format dates should be in when presented to the user

####required

Type: boolean
Default: false

Whether the required html5 attribute should be applied to the generated <select/> elements

####submitFieldName

Type: string
Default: date

Specify the name attribute for the hidden field that will contain the formatted date for submission. Note: this will overwrite an existing name attribute on an input element

####submitFormat

Type: string
Default: yyyy-mm-dd

Specify the format the submitted date should take using dd, mm and yyyy placeholders. For example dd/mm/yyyy will render 30/12/2000

####wrapperClass

Type: string
Default: date-dropdowns

Specify a classname to add to the widget wrapper


###Methods

####destroy

Call the destroy method to undo any changes made during the plugin's initialisation.

Example:

$("#date-dropdown").dateDropdowns('destroy');

###Contributing Feel free to submit any fixes or propose any additional functionality via pull request or issue, making sure any changes take place in /src. Any code changes must pass the JSHint validation, and where possible also update the minified file.

####Minification and Validation Both are automated via Grunt. Run npm_install to install the required dependencies, then run grunt from the root of the project to handle the tasks.

###To Come

  • Ability to specify relative dates as default values (e.g. today, +1 week or my wedding anniversary).
  • Ability to pass an instantiated date() object as a default value
  • Similarly formatted time inputs (hours : minutes, optional seconds). This is likely to be a separate file to avoid unnecessary bloat for users who only need date inputs, but a merged version should also be available.
  • And maybe more, who knows..

jquery-date-dropdowns's People

Contributors

abijeet avatar icklechris avatar robertleeplummerjr avatar

Watchers

 avatar

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.