Git Product home page Git Product logo

ember-date-picker's Introduction

ember-date-picker

A lightweight, mobile-optimized, date picker component for ember.js applications.

DISCLAIMER: This is beta software and has yet to be battle tested in a wide range of environments. As such, it should be used with caution in production apps. If you encounter any bugs or browser-specific anomalies, please submit an issue or a pull request. Thanks!

Demo

http://billdami.com/ember-date-picker/

Features

  • Lightweight (~4k javascript / ~1k css, minified and gzipped, including dependencies)
  • Spin box style UI for fast date selection (built using ember-spin-box)
  • Supports mousewheel, keyboard, and touch-based control
  • Mobile-optimized slide-up panel UI on small screens (480px width and below)
  • i18n/l10n support
  • Optional integration with moment.js
  • Works well with Bootstrap 3

Installation

  1. bower install ember-date-picker or grab the files in dist/.
  2. Install ember-spin-box dependency (will already be downloaded if you used bower on step 1)
  3. Add dist/ember-date-picker.min.js to your application's javascript assets.
  4. Add dist/ember-date-picker.min.css to your application's css assets. Or if you use LESS, and intend to customize the component's styles, you can import lib/styles/ember-date-picker.less.
  5. Optional: Install moment.js to enable custom date format parsing/output.

Usage

ember-date-picker is comprised of several sub-components, namely {{date-picker-input}} and {{date-picker-controls}}, for optimal efficiency and compatibility with a wide range of application structures, especially when a view contains multiple date pickers (the inputs may share a a single instance of {{date-picker-controls}}). With this in mind, the minimum required syntax for rendering a date picker is as follows:

{{date-picker-input controls="my-datepicker" value=myDate}}
{{date-picker-controls id="my-datepicker"}}

The controls parameter of the {{date-picker-input}} must reference the id of an existing {{date-picker-controls}} component. Note that the id given to the {{date-picker-controls}} is also used as its HTML id attribute value, so make sure that it is unique!

{{date-picker-input}} Parameters

  • Any valid HTML text input element attribute
    Since {{date-picker-input}} renders a regular text input element, any valid HTML attribute (e.g. value, class, placeholder, ect) may be provided.
  • controls (string, required)
    The id of the {{date-picker-controls}} component that the input is associated with.
  • dateFormat (string)
    The format for parsed and displayed dates (i.e. the input's value). This parameter will only be used if moment.js is installed, otherwise the native Date.parse() and Date.toLocaleDateString() functions will be used to parse and format dates, respectively. See the moment.js docs for all available formatting tokens.
  • minYear (int|string|bool, default: false)
    The minimum selectable year. When set to false, there is no minimum year. A string value may be provided to specify a year relative to the current date (e.g. "-10", or "+25").
  • maxYear (int|string|bool, default: false)
    The maximum selectable year. When set to false, there is no maximum year. A string value may be provided to specify a year relative to the current date (e.g. "-10", or "+25").
  • onUpdate (string)
    The name of an action to send when the input's value has been updated. The new value is sent as the action's only parameter.

{{date-picker-controls}} Parameters

  • id (string, required)
    A unique identifier that {{date-picker-input}} uses to associate with the component via its controls parameter.

  • i18n (object)
    Localized text strings for the controls UI. If provided, this parameter must match exactly the structure of the default i18n object below:

    {
      done: "Done",
      clear: "Clear",
      today: "Today",
      monthNames: [
        "January", "February", "March", "April", "May", "June",
        "July", "August", "September", "October", "November", "December"
      ]
    }
    
  • dateFormat (string)
    The default date format for the {{date-picker-controls}} component. If an associated {{date-picker-input}} specifies its own dateFormat, it will override this setting while that input is active.

  • minYear (int|string|bool, default: false)
    The default minimum year for the {{date-picker-controls}} component. If an associated {{date-picker-input}} specifies its own minYear, it will override this setting while that input is active.

  • maxYear (int|string|bool, default: false)
    The default maximum year for the {{date-picker-controls}} component. If an associated {{date-picker-input}} specifies its own maxYear, it will override this setting while that input is active.

ember-date-picker's People

Contributors

billdami avatar

Stargazers

Андрей avatar  avatar Hank Liang avatar  avatar  avatar Johnny avatar  avatar moyu avatar Zach avatar Alexander Sulim avatar Earl Lee avatar Vaidas Unchained avatar Tarun Arora avatar Roman Kuznietsov avatar Paul Ferrett avatar Frank Lin avatar Aaron Renoir avatar Deniss Alimovs avatar  avatar Guilherme Aiolfi avatar Jeremy Franz avatar Ant Ramm avatar Chris Masters avatar Hector Zarco  avatar Haris Pobric avatar Eric Chernuka avatar Sean Goresht avatar Rick Song avatar

Watchers

 avatar Johnny avatar Dan Maglasang avatar Tarun Arora avatar

ember-date-picker's Issues

how to change spin-box items order?

Hi, this is really a good job!

Looking at the template it seems that the items order (month-day-year) is hardcoded. Do you think it could be possible to use a parameter for {{date-picker-controls}} to change that order?

Here in Italy month-day-year seems really "strange" (we use day-month-year).

Thank you :)

if using MM/YYYY don't show days

maybe isn't a big deal but it would avoid some confusion when days aren't relevant. Seriously, this could be dumb but just tossing it out there to get your reaction.

High sensetivity touch pad issues

If the user is using a sensitive touchpad (e.g. they have their touchpad sensitivity settings turned up high) the scroll capability of the datepicker becomes impossible to use. At minimum the user can move 4-5 values at a time, not one to the next as you would expect.

If you have a mac or other device touchpad you can recreate this issue by increasing your touchpad sensitivity.

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.