geomoment-angular

An angular module for date formatting; wraps geomoment. For use with browserify.

npm install geomoment-angular
48 downloads in the last month

geomoment-angular

An angular.js module for date formatting with explicit timezones; wraps geomoment.

examples

setup:

angular.module('my-module', ['geomoment']);

service:

injectedFunction = ['geomoment', function(geomoment) {
  geomoment.day('2013-02-08');
}];

filters:

Filter exampleResult
{{'2013-02-08T09:30' | formatDate:tzid:'h:mm:ssa'}}9:30:00am
{{'2013-02-08' | formatDay:'weekday'}}Friday
{{'2013-02-08T09:30' | addTime:'days':1 | formatDay:'MMM Do YYYY'}}Feb 9th 2013
{{'2013-02-08T09:30' | subtractTime:'hours':9 | formatDate:tzid:'h:mma'}}12:30am

directive:

<form name='dateForm'>
  <input ngModel='date' geomoment='YYYY-MM-DD h:mm a' tzid='America/Los_Angeles'>
</form>

The geomoment directive will convert a string representation of a date (expressed in the geomoment attr) into a javascript Date object. It uses the geomoment library to parse input dates, so it does a pretty good job of interpolating human input.

License

The MIT License (MIT)

Copyright (c) 2014 Good Eggs Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

npm loves you