Change default item date to now if item date couldn't be parsed

This commit is contained in:
Shadowfacts 2020-01-29 21:59:50 -05:00
parent 2086a31537
commit bc8b3a8a38
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 2 additions and 2 deletions

View File

@ -63,7 +63,7 @@ defmodule Frenzy.Item do
__meta__: Ecto.Schema.Metadata.t(), __meta__: Ecto.Schema.Metadata.t(),
id: integer() | nil, id: integer() | nil,
content: String.t(), content: String.t(),
date: DateTime.t() | nil, date: DateTime.t(),
creator: String.t(), creator: String.t(),
guid: String.t(), guid: String.t(),
url: String.t(), url: String.t(),

View File

@ -20,7 +20,7 @@ defmodule Frenzy.Task.CreateItem do
|> case do |> case do
{:error, reason} -> {:error, reason} ->
Logger.debug("Couldn't convert date '#{entry.date}' to UTC: #{reason}") Logger.debug("Couldn't convert date '#{entry.date}' to UTC: #{reason}")
nil Timex.now() |> DateTime.truncate(:second)
utc_date -> utc_date ->
DateTime.truncate(utc_date, :second) DateTime.truncate(utc_date, :second)