Coder Social home page Coder Social logo

rtorr / birthdaypicker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from abecoffman/birthdaypicker

0.0 3.0 0.0 108 KB

Attempts to mimic the functionality of the birthday select lists on the Facebook signup page. It also adds some additional options.

Home Page: http://plugins.jquery.com/project/birthdaypicker

JavaScript 100.00%

birthdaypicker's Introduction

#Overview The birthday picker seeks to emulate the functionality of the birthday picker on the Facebook signup page. It uses three select boxes to choose a date, and tries to ensure that the date is valid by accounting for leap years, etc... It also has a number of options, making it somewhat customizable. The birthday picker generates the following markup:

<fieldset class='birthday-picker'>
    <select class='birth-year' name='birth[year]'></select>
    <select class='birth-month' name='birth[month]'></select>
    <select class='birth-day' name='birth[day]'></select>
    <input type='hidden' name='birthdate' />
</fieldset>

It also adds an option list to each of the select boxes, changing the options dynamically based on plugin settings and user interactions.

#Options As with most plugins, the birthdaypicker can be passed a hash of options as follows:

$("div").birthdaypicker(options={});

The following options are currently supported:

###maxAge (number)

Default value: 120

The maxAge setting determines the oldest year you can pick for a birthday. So if you set the maxAge to 100 and the current year is 2010, then the oldest year you can pick will be 1910.

###minAge (number)

Default value: 0

The opposite of maxAge. If current year is 2010 and minAge is set to 18, the earliest year that can be picked is 1992.

###futureDates (boolean) ####Default value: false The futureDates setting determines whether birthdays in the future can be selected. Unless you need to support entering birthdays of unborn babies, this should generally be false.

###maxYear (number) ####Default value: current year The maxYear setting allows you to set the maximum year that can be chosen, counting up from 0. If you pass in a year (such as 1980) then it uses that year. If you pass in a number under 1000 (such as 5) then it adds it to the current year, so if the year was 2010 then the maxYear would become 2015. If you want the maxYear to be in the future, you must set futureDates to true. If you want the maxYear in the past, you can pass in a negative number or a past year (if its over 1000).

###dateFormat (string) ####Default value: middleEndian The dateFormat setting determines the order of the select fields in the markup and supports the following three values:

  • middleEndian: Month, Day, Year
  • littleEndian: Day, Month, Year
  • bigEndian: Year, Month, Day

###monthFormat (string) ####Default value: short The monthFormat setting determines the text displayed in the month select box. It can be either short, or long. i.e. Jan or January

###placeholder (boolean) ####Default value: true The placeholder adds a default option to each select list just like Facebook does on their signup page. The default option just says Month, Day, or Year with a colon after it. If you keep this set to true, you will need to add logic, preferably on the client and server, to ensure this option isn't chosen. The value for these options is 0.

###defaultDate (string) ####Default value: false The defaultDate must be a date that can be parsed by the Javascript date library. I recommend passing a string in one of the following formats: MM-DD-YYYY or YYYY-MM-DD.

###hiddenDate (boolean) ####Default Value: true The hiddenDate adds a hidden input field named "birthdate" to the fieldset which concatenates all of the individual select boxes into a single date. This date is only available after the user has selected a date in each of the select boxes. It can make server side handling easier as you only have to worry about one field.

###legend (string)

####Default value: null The legend setting adds a legend to the fieldset. You can pass in any string.

birthdaypicker's People

Contributors

abecoffman avatar albanr avatar asser avatar kidsil avatar lookfirst avatar neagle avatar renyi avatar rtorr avatar waywardspooky avatar

Watchers

 avatar  avatar  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.