Date has two formatting alternatives, a callback method defined in returns, or a moment-js valid date-format.
Examples,
//Callback method.
Duns.date().returns(function(val) {
//return custom reformatting
}).init('2015-01-01').format();
//Will return 2015-01
Duns.date().returns('YYYY-MM').init('2015-01-01').format();
//Note that in this example 20150101 is not a valid moment-format, but defining an explicit pattern allows us to use the shorthand notation either way.
Duns.date().pattern('YYYYMMDD').returns('YYYY-MM').init('20150101').format();
Date has two formatting alternatives, a callback method defined in returns, or a moment-js valid date-format.
Examples,