angular-moment
Advanced tools
Comparing version 1.0.0-beta.5 to 1.0.0-beta.6
@@ -1,2 +0,2 @@ | ||
/* angular-moment.js / v1.0.0-beta.5 / (c) 2013, 2014, 2015, 2016 Uri Shaked / MIT Licence */ | ||
/* angular-moment.js / v1.0.0-beta.6 / (c) 2013, 2014, 2015, 2016 Uri Shaked / MIT Licence */ | ||
@@ -181,3 +181,5 @@ 'format amd'; | ||
*/ | ||
fullDateFormat: null | ||
fullDateFormat: null, | ||
fullDateThresholdUnit: 'day' | ||
}) | ||
@@ -201,2 +203,4 @@ | ||
var fullDateFormat = amTimeAgoConfig.fullDateFormat; | ||
var fullDateThresholdUnit = amTimeAgoConfig.fullDateThresholdUnit; | ||
var localDate = new Date().getTime(); | ||
@@ -231,4 +235,4 @@ var modelName = attr.amTimeAgo; | ||
function updateTime(momentInstance) { | ||
var daysAgo = getNow().diff(momentInstance, 'day'); | ||
var showFullDate = fullDateThreshold && daysAgo >= fullDateThreshold; | ||
var timeAgo = getNow().diff(momentInstance, fullDateThresholdUnit); | ||
var showFullDate = fullDateThreshold && timeAgo >= fullDateThreshold; | ||
@@ -324,2 +328,7 @@ if (showFullDate) { | ||
attr.$observe('amFullDateThresholdUnit', function (newValue) { | ||
fullDateThresholdUnit = newValue; | ||
updateMoment(); | ||
}); | ||
scope.$on('$destroy', function () { | ||
@@ -517,3 +526,3 @@ cancelTimer(); | ||
.filter('amCalendar', ['moment', 'amMoment', 'angularMomentConfig', function (moment, amMoment, angularMomentConfig) { | ||
function amCalendarFilter(value) { | ||
function amCalendarFilter(value, referenceTime, formats) { | ||
if (isUndefinedOrNull(value)) { | ||
@@ -524,3 +533,3 @@ return ''; | ||
var date = amMoment.preprocessDate(value); | ||
return date.isValid() ? date.calendar() : ''; | ||
return date.isValid() ? date.calendar(referenceTime, formats) : ''; | ||
} | ||
@@ -527,0 +536,0 @@ |
# Changelog | ||
## 1.0.0-beta.6 - 2016-04-24 | ||
- Support for setting the units of the full date threshold of `am-time-ago` ([#237](https://github.com/urish/angular-moment/pull/237), contributed by [denistrustepain](https://github.com/denistrustepain)) | ||
- Add optional arguments `referenceTime` and `formats` to the `amCalendar` filter ([#241](https://github.com/urish/angular-moment/pull/241), contributed by [Nitro-N](https://github.com/Nitro-N)) | ||
- Support moment 2.13.x and above | ||
## 1.0.0-beta.5 - 2016-03-18 | ||
@@ -4,0 +9,0 @@ - Bugfix: `amTimeAgo` shouldn't convert the time to local timezone on the element's `title` attribute ([#226](https://github.com/urish/angular-moment/pull/226), contributed by [stackia](https://github.com/stackia)) |
{ | ||
"name": "angular-moment", | ||
"version": "1.0.0-beta.5", | ||
"version": "1.0.0-beta.6", | ||
"main": "angular-moment.js", | ||
@@ -18,20 +18,19 @@ "repository": { | ||
"dependencies": { | ||
"moment": ">=2.8.0 <2.13.0" | ||
"moment": ">=2.8.0 <3.0.0" | ||
}, | ||
"devDependencies": { | ||
"bower": "1.6.3", | ||
"coveralls": "2.11.4", | ||
"grunt": "0.4.5", | ||
"grunt-cli": "0.1.13", | ||
"grunt-contrib-jshint": "0.11.3", | ||
"grunt-contrib-uglify": "0.9.2", | ||
"grunt-karma": "0.12.1", | ||
"grunt-ngdocs": "0.2.9", | ||
"jasmine-core": "2.3.4", | ||
"phantomjs": "^1.9.19", | ||
"karma": "0.13.19", | ||
"karma-coverage": "0.5.3", | ||
"karma-jasmine": "0.3.6", | ||
"karma-phantomjs-launcher": "0.2.1", | ||
"load-grunt-tasks": "3.3.0" | ||
"bower": "1.7.9", | ||
"coveralls": "2.11.9", | ||
"grunt": "1.0.1", | ||
"grunt-cli": "1.2.0", | ||
"grunt-contrib-jshint": "1.0.0", | ||
"grunt-contrib-uglify": "1.0.1", | ||
"grunt-karma": "0.12.2", | ||
"jasmine-core": "2.4.1", | ||
"phantomjs-prebuilt": "2.1.7", | ||
"karma": "0.13.22", | ||
"karma-coverage": "0.5.5", | ||
"karma-jasmine": "0.3.8", | ||
"karma-phantomjs-launcher": "1.0.0", | ||
"load-grunt-tasks": "3.5.0" | ||
}, | ||
@@ -38,0 +37,0 @@ "engines": { |
@@ -19,8 +19,23 @@ angular-moment | ||
You can choose your preferred method of installation: | ||
* Through bower: `bower install angular-moment moment --save` | ||
* Through bower: `bower install angular-moment --save` | ||
* Through npm: `npm install angular-moment moment --save` | ||
* Through NuGet: `Install-Package angular-moment Moment.js` | ||
* From a CDN: [jsDelivr](https://cdn.jsdelivr.net/angular.moment/1.0.0-beta.5/angular-moment.min.js) or [CDNJS](https://cdnjs.cloudflare.com/ajax/libs/angular-moment/1.0.0-beta.5/angular-moment.min.js) | ||
* From a CDN: [jsDelivr](https://cdn.jsdelivr.net/angular.moment/1.0.0-beta.6/angular-moment.min.js) or [CDNJS](https://cdnjs.cloudflare.com/ajax/libs/angular-moment/1.0.0-beta.6/angular-moment.min.js) | ||
* Download from github: [angular-moment.min.js](https://raw.github.com/urish/angular-moment/master/angular-moment.min.js) | ||
Instructions for using moment-timezone with webpack | ||
---------- | ||
Even if you have `moment-timezone` in your `package.json`, `angular-moment` will not be able to use it unless you override | ||
moment using Angular's dependency injection [See Resolved Issue](https://github.com/urish/angular-moment/pull/234) | ||
```javascript | ||
var angular = require('angular'); | ||
require('angular-moment'); | ||
var ngModule = angular.module('ngApp',['angularMoment']); | ||
ngModule.constant('moment', require('moment-timezone')); | ||
``` | ||
Usage | ||
@@ -41,6 +56,8 @@ ----- | ||
If you need internationalization support, load specified moment.js locale file first: | ||
If you need internationalization support, load specified moment.js locale file right after moment.js: | ||
```html | ||
<script src="components/moment/moment.js"></script> | ||
<script src="components/moment/locale/de.js"></script> | ||
<script src="components/angular-moment/angular-moment.js"></script> | ||
``` | ||
@@ -159,3 +176,3 @@ | ||
```html | ||
<span>{{message.time | amCalendar}}</span> | ||
<span>{{message.time | amCalendar:referenceTime:formats}}</span> | ||
``` | ||
@@ -261,3 +278,3 @@ | ||
functionality will not be available. You will also need to include a timezone data file that | ||
you can create using the [Timezone Data Builder](http://momentjs.com/timezone/data/) | ||
you can create using the [Timezone Data Builder](http://momentjs.com/timezone/) | ||
or simply download from [here](https://rawgithub.com/qw4n7y/7282780/raw/6ae3b334b295f93047e8f3ad300db6bc4387e235/moment-timezone-data.js). | ||
@@ -264,0 +281,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58887
14
652
287
+ Addedmoment@2.30.1(transitive)
- Removedmoment@2.12.0(transitive)
Updatedmoment@>=2.8.0 <3.0.0