Coder Social home page Coder Social logo

dmtw / angular-schema-form-datepicker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mrfelton/angular-schema-form-datepicker

0.0 1.0 0.0 100 KB

Datepicker add-on for Angular Schema Form using pickadate!

License: MIT License

JavaScript 100.00%

angular-schema-form-datepicker's Introduction

Angular Schema Form Date Picker Add-on

This is an add-on for Angular Schema Form.

Build Status Bower version

Everyone loves a nice date picker - now you can have your very own date picker in Schema Form! The date picker add-on uses the excellent jQuery-based date picker, pickadate.js.

Dates in JSON Schema are of type "string" and follow the RFC 3339 date fomat, which, in turn, follows ISO 8601. What does that mean for you? Basically, just stick with the format yyyy-mm-dd and you'll be fine (...but you can change it if you must).

Within Schema Form, pickadate only supports dates - not times.

Installation

The date picker is an add-on to the Bootstrap decorator. To use it, just include bootstrap-datepicker.min.js after bootstrap-decorator.min.js.

You'll need to load a few additional files to use pickadate:

  1. jQuery (pickadate depends on it)
  2. The pickadate source files (see the pickadate.js GitHub page for documentation)
  3. The pickadate CSS (you'll have to choose theme)
  4. Translation files for whatever language you want to use

Easiest way is to install is with bower, this will also include dependencies:

$ bower install angular-schema-form-datepicker

Usage

The datepicker add-on adds a new form type, datepicker, and a new default mapping.

Form Type Becomes
datepicker a pickadate widget
Schema Default Form type
"type": "string" and "format": "date" datepicker

Form Type Options

The datepicker form type takes two date range options: minDate and maxDate. minDate and maxDate both accept one of the following as values:

  1. A string in the format yyyy-mm-dd,
  2. A unix timestamp (as a Number), or
  3. An instance of Date

It is also possible to set the date format using the format option, which is used to format the date stored by AngularJS, but note that in doing so you break the standard and other JSON Schema validators might complain. The view date displayed by pickadate is set by the translation files. see Installation

Here's an example:

{
  key: "birthDate",
  minDate: "1900-01-01",
  maxDate: new Date(),
  format: "yyyy-mm-dd"
}

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.