dwyl / github-backup

:octocat: :back: 🆙 Backup your GitHub Issues so you can still work when (they/you are) offline.
https://github-backup.herokuapp.com
GNU General Public License v2.0
32 stars 3 forks source link

Change truncate naive date time fn to be Elixir 1.5 compatible for heroku #56

Closed Cleop closed 6 years ago

Cleop commented 6 years ago

Our current display of the date/time that a comment is written uses truncate which is from Elixir 1.6. As heroku uses v.1.5 we need to change this so that it is compatible.

Initial solution:

 def format_date(date) do
    date
    |> NaiveDateTime.to_iso8601
    |> tidyISODate
  end

  def tidyISODate(iso_date) do
    iso_date
    |> String.replace("T", " ")
    |> String.split(".")
    |> List.first
  end
nelsonic commented 6 years ago

looks good. 👍