module Jekyll::Algolia::FileBrowser

def self.date(file)

while they haven't.
Otherwise the diff indexing mode will think that records have changed
defined, we have to make sure the date is actually nil when we index it.
Note that because the default date is the current one if none is

For pages, only dates defined in the front-matter will be used.

current date.
front-matter or the filename prefix. If none is set, Jekyll will use the
All collections (including posts) will have a date taken either from the

file - The Jekyll file

Public: Returns a timestamp of the file date
def self.date(file)
  date = file.data['date']
  return nil if date.nil?
  # The date is *exactly* the time where the `jekyll algolia` was run.
  # What a coincidence! It's a safe bet to assume that the original date
  # was nil and has been overwritten by Jekyll
  return nil if date.to_i == Jekyll::Algolia.start_time.to_i
  date.to_i
end