npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ng-moment-picker

v0.8.2

Published

Angular Moment Picker is a fork of Indri's AngularJS directive

Downloads

3

Readme

Angular Moment Picker

Join the chat at https://gitter.im/indrimuska/angular-moment-picker

NPM version NPM downloads MIT License

Check out the homepage at http://indrimuska.github.io/angular-moment-picker/.

Angular Moment Picker is a native AngularJS directive for date and time picker that uses Moment.js and does not require jQuery.

Installation

Get Angular Moment Picker from npm, bower or git:

  npm install angular-moment-picker
bower install moment-picker
  git clone   https://github.com/indrimuska/angular-moment-picker.git

Include style and script in your page:

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment-with-locales.js"></script>
<script src="//cdn.rawgit.com/indrimuska/angular-moment-picker/master/dist/angular-moment-picker.min.js"></script>
<link href="//cdn.rawgit.com/indrimuska/angular-moment-picker/master/dist/angular-moment-picker.min.css" rel="stylesheet">

Add moment-picker dependency to your module:

var myApp = angular.module('myApp', ['moment-picker']);

Provide the attribute to your element:

<div moment-picker="myDate"> {{ myDate }} </div>

Demo

Check out the demo page at http://indrimuska.github.io/angular-moment-picker/.

The views

Decade view | Year view | Month view :---:|:---:|:---: Decade view | Year view | Month view Day view | Hour view | Minute view Day view | Hour view | Minute view

Options

To configure Angular Moment Picker you have to append to your block or your input the attribute options you want to set.

<div moment-picker="ctrl.birthday" locale="fr" format="LL">
    Mon anniversaire est le {{ ctrl.birthday }}
</div>
<input moment-picker="ctrl.dateFormatted" ng-model="ctrl.momentDate" format="DD/MM/YYYY">

Property | Default | Description ---|---|--- moment-picker | | Two-way bindable property as datetime string value. ng-model | | Two-way bindable property as Moment.js object. locale | "en" | Locale code. 1 format | "L LTS" | Format of the output value and min/max date. 1 min-view | "decade" | Minimum navigable view. max-view | "minute" | Maximum navigable view. start-view | "year" | Initial view when the picker is open. min-date | | Two-way bindable property representing the minimum selectable date (as String in the same format of the value, or as a Moment.js object). max-date | | Two-way bindable property representing the maximum selectable date (as String in the same format of the value, or as a Moment.js object). disable | false | Disables the picker if truly. autoclose | true | Closes the picker after selecting a date. today | false | Highlights the current day. keyboard | false | Allows using the keyboard to navigate the picker. additions | { top: undefined, bottom: undefined } | Template url for custom contents above and below each picker views (inside the dialog).

Methods

Append your method to your element and define its behavior in the controller.

<div moment-picker="ctrl.exhibition" format="dddd D MMMM" selectable="ctrl.isSelectable(date, type)">
	Next exhibition is on {{ ctrl.exhibition }}.
</div>
ctrl.isSelectable = function (date, type) {
	// disable all Sundays in the Month View
	return type != 'day' || date.format('dddd') != 'Sunday';
};

Method | Parameters | Description ---|---|--- selectable | date, type | Return true if the given date can be selected in the current view. Please note that this method is called for every date in the view, every time a view is rendered, so be careful, it may affect performances.

Events

As for methods, to bind an event you only need to attach the right property to your picker.

<div moment-picker="ctrl.meeting" format="HH:mm A" change="ctrl.onChange(newValue, oldValue)">
    The meeting starts at {{ ctrl.meeting }}.
</div>
ctrl.onChange = function (newValue, oldValue) {
	$log.log('Meeting changed from ' + oldValue + ' to ' + newValue);
};

Event | Parameters | Description ---|---|--- change | newValue, oldValue | Function fired upon change in picker value.

momentPickerProvider

Angular Moment Picker comes out with its own provider, in order to define your own configuration for all the pickers in your app.

angular
    .module('myApp', ['moment-picker'])
    .config(['momentPickerProvider', function (momentPickerProvider) {
        momentPickerProvider.options({
            /* ... */
        });
    }]);

Property | Default | Description ---|---|--- locale | "en" | Locale code. 1 format | "L LTS" | Format of the output value and min/max date. 1 min-view | "decade" | Minimum navigable view. max-view | "minute" | Maximum navigable view. start-view | "year" | Initial view after picker opening. autoclose | true | Closes the picker after selecting a date. today | false | Highlights the current day. keyboard | false | Allows using the keyboard to navigate the picker. show-header | true | Shows the header in the view. left-arrow | "&larr;" | Left arrow string (HTML allowed). right-arrow | "&rarr;" | Right arrow string (HTML allowed). additions | { top: undefined, bottom: undefined } | Template url for custom contents above and below each picker views (inside the dialog). years-format | "YYYY" | Years format in decade view. months-format | "MMM" | Months format in year view. days-format | "D" | Days format in month view. hours-format | "HH:[00]" | Hours format in day view. hours-start | 0 | First rendered hour in day view (24h format). hours-end | 23 | Last rendered hour in day view (24h format). minutes-format | 2 | Minutes format in hour view. minutes-step | 5 | Step between each visible minute in hour view. minutes-start | 0 | First rendered minute in hour view. minutes-end | 59 | Last rendered minute in hour view. seconds-format | "ss" | Seconds format in minute view. seconds-step | 1 | Step between each visible second in minute view. seconds-start | 0 | First rendered second in minute view. seconds-end | 59 | Last rendered second in minute view.

Notes

  1. Locale codes and format tokens are available at http://momentjs.com/.
  2. Locale format LT without meridiem part (AM/PM, am/pm).

Builder

Try the online Angular Moment Picker Builder:

http://indrimuska.github.io/angular-moment-picker/#builder.

License

Copyright (c) 2015 Indri Muska. Licensed under the MIT license.