ivan-magda / UpcomingMovies

tvOS example app, shows upcoming movies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect TimeInterval to number of days conversion

ivan-magda opened this issue · comments

In TMDbConfig.swift:

  /// Returns the number days since the config was last updated.
  var daysSinceLastUpdate: Int? {
    if let lastUpdate = dateUpdated {
      return Int(Date().timeIntervalSince(lastUpdate)) / 60*60*24
    } else {
      return nil
    }
  }

Should be:

  /// Returns the number days since the config was last updated.
  var daysSinceLastUpdate: Int? {
    if let lastUpdate = dateUpdated {
      return Int(Date().timeIntervalSince(lastUpdate)) / (60 * 60 * 24)
    } else {
      return nil
    }
  }