-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
114 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
defmodule S3DirectUpload.DateUtil do | ||
|
||
@moduledoc false | ||
|
||
def today_datetime do | ||
%{DateTime.utc_now | hour: 0, minute: 0, second: 0, microsecond: {0,0}} | ||
|> DateTime.to_iso8601(:basic) | ||
end | ||
|
||
def today_date do | ||
Date.utc_today | ||
|> Date.to_iso8601(:basic) | ||
end | ||
|
||
def expiration_datetime do | ||
DateTime.utc_now() | ||
|> DateTime.to_unix() | ||
|> Kernel.+(60 * 60) | ||
|> DateTime.from_unix!() | ||
|> DateTime.to_iso8601() | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
defmodule S3DirectUpload.StaticDateUtil do | ||
|
||
@moduledoc false | ||
|
||
def today_datetime do | ||
static_datetime() | ||
|> DateTime.to_iso8601(:basic) | ||
end | ||
|
||
def today_date do | ||
static_date() | ||
|> Date.to_iso8601(:basic) | ||
end | ||
|
||
def expiration_datetime do | ||
static_datetime() | ||
|> DateTime.to_unix() | ||
|> Kernel.+(60 * 60) | ||
|> DateTime.from_unix!() | ||
|> DateTime.to_iso8601() | ||
end | ||
|
||
defp static_datetime do | ||
~N[2017-01-01 00:00:00] | ||
|> DateTime.from_naive!("Etc/UTC") | ||
end | ||
|
||
defp static_date do | ||
~D[2017-01-01] | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters