Coder Social home page Coder Social logo

ember-datepicker's Introduction

#Ember CLI Datepicker Build Status

Maintainer needed

If anybody is keen to take over the maintenance of this addon, please get in touch with me. I'm no longer actively working with ember (although I still love the framework) and am not able to give this the attention it deserves.

Description

This component is an Ember CLI add-on and uses moment.js along with pickaday to create an extensible ember component. This is still a work in progress. Pull requests are welcome.

Installation

# install the addon and include it in your project
$ ember install ember-cli-datepicker

Basic Usage

{{date-picker date=mydate valueFormat='YYYY-MM-DD'}}

Demo

Check out the demo on github pages. Alternatively you can clone this repo and run the app

$ sudo npm install -g ember-cli
$ git clone [email protected]:squirelabs/ember-datepicker
$ cd ember-datepicker
# install dependencies
$ npm install; bower install
# fire up local server
$ ember serve

Options

When calling the the datepicker, the following options are available:

General Options

date

Type: String or Date

This variable will be changed when the user changes the date. It will be updated using the valueFormat specified.

valueFormat

Type: String Default: X

This is the format in which the date is passed back to the controller.

This format must be one of the following:

format

Type: String Default: YYYY-MM-DD

This is the format in which the date is displayed in the input box.

yearRange

Type: String or Array Default: -3,4

This range of years to be displayed. It is either in the form of a relative range (the first option goes from the current year back 3 years, and forward 4 years), or it can be defined in absolute terms. The value may also be an array. Here are some examples of valid inputs.

yearRange: "-3,4"
yearRange: [-2,8]
yearRange: [2000,2020]
yearRange: "2010,2016"

numberOfMonths

Type: Number Default: 1

The number of months to display in the datepicker component.

allowBlank

Type: Boolean Default: false

Can be set to allow blank dates (date = null). By default, null values will be replaced by the current date on initial render and every time the datepicker is closed. With this option, date may stay null.

utc

Type: Boolean Default: false

Per default, the created date value will obtain the computer's timezone and therefore not have UTC midnight as its time and will be a few hours off instead.

For example, when your timezone is 8 hours ahead of UTC: Creating a date object from the input "2000-01-01" will result in "1999-12-31T16:00:00.000Z", because when your computer has the time of 00:00:00 on Jan 1st 2000, UTC time is still in 1999. This is technically correct, but may not be what you want.

If you want to have easy-to-compare date strings in your JSON, set utc to true and you will get "2000-01-01T00:00:00.000Z" as expected.

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.