diff --git a/apps/alarm/app.js b/apps/alarm/app.js index 64f233c5c..053505187 100644 --- a/apps/alarm/app.js +++ b/apps/alarm/app.js @@ -123,7 +123,6 @@ function showNewMenu(group) { } function showEditAlarmMenu(selectedAlarm, alarmIndex, withDate, scroll, group) { - console.log(scroll); var isNew = alarmIndex === undefined; var alarm = require("sched").newDefaultAlarm(); diff --git a/apps/datetime_picker/README.md b/apps/datetime_picker/README.md index 8dac1dceb..f602d44e1 100644 --- a/apps/datetime_picker/README.md +++ b/apps/datetime_picker/README.md @@ -1,9 +1,36 @@ # App Name -Datetime Picker allows to swipe along the bars to select date and time elements, e.g. for the datetime of Events in the Alarm App. As a standalone app, it allows to see the weekday of a given date and, once a datetime is selected, the number of days and time between that datetime and now. +Datetime Picker allows to swipe along the bars to select date and time elements, e.g. for the datetime of Events in the Alarm App. Screenshot: ![datetime with swipe controls](screenshot.png) ## Controls Swipe to increase or decrease date and time elements. Press button or go back to select shown datetime. + +![datetime with numbered swipe controls](screenshot2.png) + +1. Year: swipe up to increase, down to decrease +2. Month: swipe right to increase, left to decrease +3. Day: swipe up to increase, down to decrease +4. Week: swipe up to increase week (same day next week), down to decrease (same day previous week) +5. Weekday: swipe right to increase, left to decrease (basically the same effect as 3, but with a focus on the weekday) +6. Hour: swipe right to increase, left to decrease +7. Minutes: swipe right to increase, left to decrease +8. 15 minutes: 00, 15, 30 or 45 minutes; swipe up to increase, down to decrease; wrap-around i.e. goes back to 00 after increasing from 45 + +## How to use it in code + +Sample code which would show a prompt with the number of days and hours between now and the selected datetime: + + require("datetimeinput").input().then(result => { + E.showPrompt(`${result}\n\n${require("time_utils").formatDuration(Math.abs(result-Date.now()))}`, {buttons:{"Ok":true}}).then(function() { + load(); + }); + }); + +To set the initial value, pass a Date object named _datetime_, e.g. for today at 9:30 : + + var datetime = new Date(); + datetime.setHours(9, 30); + require("datetimeinput").input({datetime}).then(... \ No newline at end of file diff --git a/apps/datetime_picker/metadata.json b/apps/datetime_picker/metadata.json index df968589e..63ca7aa17 100644 --- a/apps/datetime_picker/metadata.json +++ b/apps/datetime_picker/metadata.json @@ -2,15 +2,16 @@ "name": "Datetime picker", "shortName":"Datetime picker", "version":"0.01", - "description": "Allows to pick a date and time by swiping.", + "description": "A library that allows to pick a date and time by swiping.", "icon":"app.png", + "type":"datetimeinput", "tags":"datetimeinput", - "supports" : ["BANGLEJS2"], + "supports" : ["BANGLEJS2"], + "provides_modules" : ["datetimeinput"], "readme": "README.md", "screenshots" : [ { "url":"screenshot.png" } ], "storage": [ {"name":"datetimeinput","url":"lib.js"}, - {"name":"datetime_picker.app.js","url":"app.js"}, {"name":"datetime_picker.img","url":"app-icon.js","evaluate":true} ] } diff --git a/apps/datetime_picker/screenshot2.png b/apps/datetime_picker/screenshot2.png new file mode 100644 index 000000000..9a1f9d048 Binary files /dev/null and b/apps/datetime_picker/screenshot2.png differ