You should sort the dates using a compare function that simply strips the periods before rearranging them:
var arr = ["2014.02.01", "2014.03.01", "2014.03.01", "2014.03.01", "2014.03.01", "2014.03.17", "2014.04.01", "2014.04.01", "2014.04.09"]
arr.sort(function(a, b) {
return (a.replace('.','') - b.replace('.',''));
}).forEach(function(v,i){arr[i] = v.split('.').reverse().join(".")});
document.write(arr.join('<br>'));
All thats required next is to turn the array into an object with a count of the recurring dates, which can also reverse the values in each string:
arr = arr.sort(function(a, b) {
return (a.replace('.','') - b.replace('.',''));
}).reduce(function(obj, v){
v = v.split('.').reverse().join('.')
if (!obj.hasOwnProperty(v)) {
obj[v] = 0;
}
++obj[v];
return obj;
},{});
But be warned, there is no guarantee that you'll get consistent ordering. In the latest version of the language specification, order is based firstly on numeric order if the property is a number, then the order properties are added. The Safari console thinks the keys are numbers so returns the following order:
Object { 01.02.2014: 1, 01.03.2014: 4, 01.04.2014: 2, 09.04.2014: 1, 17.03.2014: 1 }
but when stringified with JSON.stringify or the keys are returned by Object.keys, they're in the same order as Firefox and Chrome which return:
Object { 01.02.2014: 1, 01.03.2014: 4, 17.03.2014: 1, 01.04.2014: 2, 09.04.2014: 1 }
which is consistent with ECMAScript 2015.
To get consistent ordering, you should use ISO 8601 like dates similar to the original but without the periods. But best of all, you should not expect the order to be consistent or predictable, because it across browsers in use (unless you restrict yourself to one particular implementation that does what you want).