Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let widget = createWidget()
- widget.presentMedium()
- Script.setWidget(widget)
- Script.complete()
- function createWidget() {
- //LOGIC
- let now = new Date()
- let ampm = "AM"
- let [hours, minutes, seconds] = [now.getHours(), now.getMinutes(), now.getSeconds()]
- if(hours == 0) {hours = 12}
- if(hours > 12) {hours = hours-12; ampm = "PM"}
- hours = hours * 60 * 60 * 1000
- minutes = minutes * 60 * 1000
- seconds = seconds * 1000
- let specialDate = now.getTime() - hours - minutes - seconds
- let widget = new ListWidget()
- let widgetStack = widget.addStack()
- widgetStack.layoutVertically()
- widgetStack.addSpacer()
- let timeStack = widgetStack.addStack()
- timeStack.layoutHorizontally()
- timeStack.addSpacer()
- let time = timeStack.addDate(new Date(specialDate))
- time.applyTimerStyle()
- let ampmlabel = timeStack.addText(" " + ampm)
- return widget
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement