csblogs/feed-downloader

View on GitHub
src/http/get-last-modified-date.js

Summary

Maintainability
A
0 mins
Test Coverage
export default function getLastModifiedDate(httpHeaders) {
  const lastModifiedHeader = httpHeaders['last-modified'];
  const dateHeader = httpHeaders.date;

  let lastModifiedDate = null;

  if (lastModifiedHeader) {
    lastModifiedDate = new Date(lastModifiedHeader);
  } else if (dateHeader) {
    lastModifiedDate = new Date(dateHeader);
  }

  return lastModifiedDate;
}