Coder Social home page Coder Social logo

frehaiku / datepicker Goto Github PK

View Code? Open in Web Editor NEW
51.0 3.0 29.0 23 KB

Without jQuery-based date component with support for date ranges, muitiple calendars and more. :kissing_heart:

Home Page: https://frehaiku.github.io/DatePicker/

CSS 8.96% JavaScript 86.26% HTML 4.78%
datepicker calendar no-jquery

datepicker's Introduction

DatePicker

Without jQuery-based date component with support for date ranges, muitiple calendars and more.

Params

  • el:
    • type: Element
    • required: true
    • description: Calendar container
  • trigger:
    • type: Element
    • required: true
    • description: Provoke DatePicker show and hide
    • eg: input element(onfocus show the DatePicker)
  • default:
    • type: String
    • default: 'today'
    • eg: '2017-04-15'
    • description: Default selected date
  • isRadio:
    • type: Boolean
    • default: false
    • description: Is it date radio selected?
  • lang:
    • type: String
    • options: 'EN' | 'CN'
    • default: 'EN'
    • description: The font language, for CN will use Chinese, for EN will use English
  • position:
    • type: String
    • options: 'top' | 'right' | 'left' | 'bottom'
    • default: 'bottom'
  • interval:
    • type: Array
    • default: [1970, 2030]
    • eg:[2000, 2020]
    • description: Select abled range
  • showFn:
    • type: Function
    • description: After show callback
  • hideFn:
    • type: Function
    • description: After hide callback
  • onchange:
    • type: Function
    • description: callback which observe datePicker change

Methods

  • show:
    • type: Function
  • hide:
    • type: Function

Usage

  1. manually import calendar.css and calendar.js

  2. create DatePicker contructor, for below:

    <input type="text" id="datePicker">
    <span id="calendar"></span>
    var dateComponent = new DatePicker({
           el: document.querySelector('#calendar'),
           onchange: function (curr) {
               dateInput.value = curr;
           }
    });
    
    var dateInput = document.querySelector('#datePicker');
    
    dateInput.onfocus = function () {
        dateComponent.show();
    };

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.