adding the locale files for moment.js

also adjusted the source of its locale setting to be more comprehensive (use navigator.language and navigator.languages)
This commit is contained in:
Jared Tabor 2015-05-29 11:20:17 -04:00
parent 609ded80e2
commit c2a5b21b9e

View File

@ -1,6 +1,13 @@
angular.module('longDateFilter', []).filter('longDate', function() {
return function(input) {
var date = moment(input).locale(navigator.language);
// navigator.language is available in all modern browsers.
// however navigator.languages is a new technology that
// lists the user's preferred languages, the first in the array
// being the user's top choice. navigator.languages is currently
// comptabile with chrome>v32, ffox>32, but not IE/Safari
var lang = navigator.languages ? navigator.languages[0] : (navigator.language || navigator.userLanguage),
date = moment(input).locale(lang);
return date.format('l LTS');
};
});