mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 19:08:26 +00:00
Initial version.
Features: - Upload PDF files let them analyze - Manage meta data and items - See processing in webapp
This commit is contained in:
87
modules/webapp/src/main/elm/Util/Time.elm
Normal file
87
modules/webapp/src/main/elm/Util/Time.elm
Normal file
@ -0,0 +1,87 @@
|
||||
module Util.Time exposing (..)
|
||||
|
||||
import DateFormat
|
||||
import Time exposing (Posix, Zone, utc)
|
||||
|
||||
|
||||
dateFormatter : Zone -> Posix -> String
|
||||
dateFormatter =
|
||||
DateFormat.format
|
||||
[ DateFormat.dayOfWeekNameAbbreviated
|
||||
, DateFormat.text ", "
|
||||
, DateFormat.monthNameFull
|
||||
, DateFormat.text " "
|
||||
, DateFormat.dayOfMonthSuffix
|
||||
, DateFormat.text ", "
|
||||
, DateFormat.yearNumber
|
||||
]
|
||||
|
||||
dateFormatterShort: Zone -> Posix -> String
|
||||
dateFormatterShort =
|
||||
DateFormat.format
|
||||
[ DateFormat.yearNumber
|
||||
, DateFormat.text "/"
|
||||
, DateFormat.monthFixed
|
||||
, DateFormat.text "/"
|
||||
, DateFormat.dayOfMonthFixed
|
||||
]
|
||||
|
||||
timeFormatter: Zone -> Posix -> String
|
||||
timeFormatter =
|
||||
DateFormat.format
|
||||
[ DateFormat.hourMilitaryNumber
|
||||
, DateFormat.text ":"
|
||||
, DateFormat.minuteFixed
|
||||
]
|
||||
|
||||
isoDateTimeFormatter: Zone -> Posix -> String
|
||||
isoDateTimeFormatter =
|
||||
DateFormat.format
|
||||
[ DateFormat.yearNumber
|
||||
, DateFormat.text "-"
|
||||
, DateFormat.monthFixed
|
||||
, DateFormat.text "-"
|
||||
, DateFormat.dayOfMonthFixed
|
||||
, DateFormat.text "T"
|
||||
, DateFormat.hourMilitaryNumber
|
||||
, DateFormat.text ":"
|
||||
, DateFormat.minuteFixed
|
||||
, DateFormat.text ":"
|
||||
, DateFormat.secondFixed
|
||||
]
|
||||
|
||||
|
||||
timeZone: Zone
|
||||
timeZone =
|
||||
utc
|
||||
|
||||
{- Format millis into "Wed, 10. Jan 2018, 18:57"
|
||||
-}
|
||||
formatDateTime: Int -> String
|
||||
formatDateTime millis =
|
||||
(formatDate millis) ++ ", " ++ (formatTime millis)
|
||||
|
||||
formatIsoDateTime: Int -> String
|
||||
formatIsoDateTime millis =
|
||||
Time.millisToPosix millis
|
||||
|> isoDateTimeFormatter timeZone
|
||||
|
||||
{- Format millis into "18:57". The current time (not the duration of
|
||||
the millis).
|
||||
-}
|
||||
formatTime: Int -> String
|
||||
formatTime millis =
|
||||
Time.millisToPosix millis
|
||||
|> timeFormatter timeZone
|
||||
|
||||
{- Format millis into "Wed, 10. Jan 2018"
|
||||
-}
|
||||
formatDate: Int -> String
|
||||
formatDate millis =
|
||||
Time.millisToPosix millis
|
||||
|> dateFormatter timeZone
|
||||
|
||||
formatDateShort: Int -> String
|
||||
formatDateShort millis =
|
||||
Time.millisToPosix millis
|
||||
|> dateFormatterShort timeZone
|
Reference in New Issue
Block a user