Pebble.Time
Commands for reading watch time and timezone information.
Request structured time in init or on a timer, and combine with Pebble.Cmd.timerAfter for periodic refresh.
import Pebble.Time as Time
type Msg
= GotDateTime Time.CurrentDateTime
| GotTimezone String
init _ =
( model
, Cmd.batch
[ Time.currentDateTime GotDateTime
, Time.timezone GotTimezone
]
)
For scheduling refreshes, pair with Pebble.Cmd.timerAfter from Pebble.Cmd. See the watch-demo-time project template in the IDE.
Native Pebble C API
- Wall_Time on developer.repebble.com
Time and timezone
DayOfWeek
type DayOfWeek
= Monday
| Tuesday
| Wednesday
| Thursday
| Friday
| Saturday
| SundayStructured local time/date information from the watch runtime.
CurrentDateTime
type alias CurrentDateTime =
{ year : Int
, month : Int
, day : Int
, dayOfWeek : DayOfWeek
, hour : Int
, minute : Int
, second : Int
, utcOffsetMinutes : Int
}Structured local time/date information from the watch runtime.
currentDateTime
currentDateTime : (CurrentDateTime -> msg) -> Cmd msgRequest the current local date/time with UTC offset in minutes.
currentTimeString
currentTimeString : (String -> msg) -> Cmd msgRequest the current local time string from the watch runtime.
clockStyle24h
clockStyle24h : (Bool -> msg) -> Cmd msgRequest whether the user is using 24-hour time.
timezoneIsSet
timezoneIsSet : (Bool -> msg) -> Cmd msgRequest whether timezone data is currently available.
timezone
timezone : (String -> msg) -> Cmd msgRequest the current timezone identifier string.