2014-04-20 18:48:34 +04:00
|
|
|
/* global moment */
|
2014-06-02 00:53:16 +04:00
|
|
|
var parseDateFormats = ['DD MMM YY HH:mm',
|
|
|
|
'DD MMM YYYY HH:mm',
|
|
|
|
'DD/MM/YY HH:mm',
|
|
|
|
'DD/MM/YYYY HH:mm',
|
|
|
|
'DD-MM-YY HH:mm',
|
|
|
|
'DD-MM-YYYY HH:mm',
|
|
|
|
'YYYY-MM-DD HH:mm'],
|
2014-04-20 18:48:34 +04:00
|
|
|
displayDateFormat = 'DD MMM YY @ HH:mm';
|
|
|
|
|
|
|
|
//Parses a string to a Moment
|
|
|
|
var parseDateString = function (value) {
|
|
|
|
return value ? moment(value, parseDateFormats) : '';
|
|
|
|
};
|
|
|
|
|
|
|
|
//Formats a Date or Moment
|
|
|
|
var formatDate = function (value) {
|
|
|
|
return value ? moment(value).format(displayDateFormat) : '';
|
|
|
|
};
|
|
|
|
|
|
|
|
export {parseDateString, formatDate};
|