adius / vectual / TimeUtils.Create

Create dates and offsets.

getTimezoneOffset : Time.Posix -> Basics.Int

Return the time zone offset of current javascript environment underneath Elm in Minutes. This should produce the same result getTimezoneOffset() for a given date in the same javascript VM.

Time zone offset is always for a given date and time so an input date is required.

Given that timezones change (though slowly) this is not strictly pure, but I suspect it is sufficiently pure to be useful. Is is dependent on the timezone mechanics of the javascript VM.

Example zone stuff.

For an offset of -600 minutes, in +10:00 time zone offset.

dateFromFields : Basics.Int -> Time.Month -> Basics.Int -> Basics.Int -> Basics.Int -> Basics.Int -> Basics.Int -> Time.Posix

Create a date in current time zone from given fields.

See also dateFromFieldsRecord for same function with parameter from a record.

Call Signature

dateFromFields year month day hour minute second millisecond =

All field values are clamped to there allowed range values. Hours are input in 24 hour time range 0 to 23 valid. Returns dates in current time zone.

Using algorithm from http://howardhinnant.github.io/date_algorithms.html Specifically days_from_civil function.

The two <*>Compensate values adjust for the zone offset time introduced by epochDate as starting point.

dateFromFieldsRecord : TimeUtils.TypeAlias.DateFromFields -> Time.Posix

Alternate record signature for dateFromFields

timeFromFields : Basics.Int -> Basics.Int -> Basics.Int -> Basics.Int -> Time.Posix

Create a time in current time zone from given fields, for when you dont care about the date part but need time part anyway.

See also timeFromFieldsRecord for same function with parameter from a record.

All field values are clamped to there allowed range values. This can only return dates in current time zone.

Hours are input in 24 hour time range 0 to 23 valid.

This defaults to year 1970, month Jan, day of month 1 for date part.

timeFromFieldsRecord : TimeUtils.TypeAlias.TimeFromFields -> Time.Posix

Alternate record signature for timeFromFields

Try TimeFromFieldsTESTING