<commit_before>var moment = require('moment');

var BOXNAME_MAP = {
  'inbox': 'Inbox',
  'spam': 'Spam',
  'sent': 'Sent Mail'
};

module.exports = {

  formatBoxName: function(name) {
    return BOXNAME_MAP[name];
  },

  formatDate: function(dateString) {
    var date = moment(dateString);

    if (date.get('day') == moment().get('day')) {
      return date.format('h:mm a');
    }

    if (date.get('year') === moment().get('year')) {
      return date.format('MMM DD');
    }

    return date.format('YYYY/MM/DD');
  }

};
<commit_msg>Fix date format<commit_after>var moment = require('moment');

var BOXNAME_MAP = {
  'inbox': 'Inbox',
  'spam': 'Spam',
  'sent': 'Sent Mail'
};

module.exports = {

  formatBoxName: function(name) {
    return BOXNAME_MAP[name];
  },

  formatDate: function(dateString) {
    var date = moment(dateString);
    var now = moment();

    if (now.isSame(date, 'day')) {
      return date.format('h:mm a');
    }

    if (now.isSame(date, 'year')) {
      return date.format('MMM DD');
    }

    return date.format('YYYY/MM/DD');
  }

};

{'fraction_non_alphanumeric': 0.19387755102040816, 'fraction_numerical': 0.0, 'mean_word_length': 3.166023166023166, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3476546', 'n_tokens_mistral': 406, 'n_tokens_neox': 393, 'n_words': 77}