git ssb

0+

mixmix / patchbay-scry



Tree: 988caf44b54d771fc4246af26cbfcdec87f9dcc8

Files: 988caf44b54d771fc4246af26cbfcdec87f9dcc8 / views / new-steps / pick-times.js

1134 bytesRaw
1const { h, when, computed } = require('mutant')
2const DayPicker = require('../component/day-picker.js')
3const TimePicker = require('../component/time-picker.js')
4
5module.exports = function PickTimes (state) {
6 return h('ScryNewPickTimes', [
7 DayPicker(state),
8 when(computed(state.days, d => Boolean(d.length)),
9 h('div.time-picker', [
10 h('label', computed(state.days, days => `Same times for all dates (${days.length})`)),
11 TimePicker(state),
12 h('div.timezone', [
13 h('label', 'Timezone of your scry is'),
14 h('div.zone', [
15 getTimezone(),
16 h('span', ['(UTC ', getTimezoneOffset(), ')'])
17 ])
18 ])
19 ]),
20 h('div.time-picker-pristine', [
21 h('label', 'Dates and Times'),
22 h('div.instruction', 'Select one or multiple dates')
23 ])
24 )
25 ])
26}
27
28// functions
29
30function getTimezone () {
31 try {
32 return Intl.DateTimeFormat().resolvedOptions().timeZone
33 } catch (e) {
34 return '??'
35 }
36}
37
38function getTimezoneOffset () {
39 const offset = new Date().getTimezoneOffset() / -60
40 return offset > 0 ? `+${offset}` : offset
41}
42

Built with git-ssb-web