<commit_before>/* global GuardianAPI, NYTAPI, DomUpdater */

function fillZero(num) {
  return num < 10 ? `0${num}` : num;
}


function formatGuardianDate(date) {
  return `${date.getFullYear()}-${fillZero(date.getMonth() + 1)}-${fillZero(date.getDate())}`;
}

function formatNYTDate(date) {
  return `${date.getFullYear()}${fillZero(date.getMonth() + 1)}${fillZero(date.getDate())}`;
}

function main() {
  const guardianContentNode = document.getElementById('GuardianContent');
  const NYTContentNode = document.getElementById('NYTimesContent');

  const today = new Date(Date.now());
  console.log(today);
  // const yesterday = new Date(Date.now() - (8.64 * Math.pow(10, 7)));
  // console.log(yesterday);
  //
  const datesOfLastWeek = Array.from({ length: 6 }, (_, idx) => new Date(Date.now() - (idx +1) * (8.64 * Math.pow(10, 7))))
  //
  // const vs = Array.from({length: 6}, (_, idx) => idx + 1);
  // console.log(vs);
  console.log(datesOfLastWeek);

  GuardianAPI.getArticles(formatGuardianDate(today))
    .then(DomUpdater.buildArticleNodes)
    .then(DomUpdater.displayArticleNodes(guardianContentNode));

  NYTAPI.getArticles(formatNYTDate(today))
    .then(DomUpdater.buildArticleNodes)
    .then(DomUpdater.displayArticleNodes(NYTContentNode));
}


main();<commit_msg>Add Array of responsive dates for navDates display<commit_after>/* global GuardianAPI, NYTAPI, DomUpdater */

function main() {
  const today = new Date(Date.now());
  console.log(today);

  const datesLastWeek = Array.from({ length: 7 }, (_, idx) => new Date(today - (idx + 1) * (8.64 * Math.pow(10, 7))));
  console.log(datesLastWeek);

  const navDates = datesLastWeek.map(el => el.toDateString().slice(4, 10));
  console.log(navDates);


  const guardianContentNode = document.getElementById('GuardianContent');
  const NYTContentNode = document.getElementById('NYTimesContent');

  GuardianAPI.getArticles(formatGuardianDate(today))
    .then(DomUpdater.buildArticleNodes)
    .then(DomUpdater.displayArticleNodes(guardianContentNode));

  NYTAPI.getArticles(formatNYTDate(today))
    .then(DomUpdater.buildArticleNodes)
    .then(DomUpdater.displayArticleNodes(NYTContentNode));
}

main();


function fillZero(num) {
  return num < 10 ? `0${num}` : num;
}

function formatGuardianDate(date) {
  return `${date.getFullYear()}-${fillZero(date.getMonth() + 1)}-${fillZero(date.getDate())}`;
}

function formatNYTDate(date) {
  return `${date.getFullYear()}${fillZero(date.getMonth() + 1)}${fillZero(date.getDate())}`;
}
{'fraction_non_alphanumeric': 0.1727853152434158, 'fraction_numerical': 0.014764565043894652, 'mean_word_length': 5.2675, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '1716149', 'n_tokens_mistral': 895, 'n_tokens_neox': 858, 'n_words': 140}