Change default item date to now if item date couldn't be parsed
This commit is contained in:
parent
2086a31537
commit
bc8b3a8a38
|
@ -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(),
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue