0.9.2 • Published 6 years ago

mithril-timepicker v0.9.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

mithril-timepicker

Pick a time! But only if you're using Mithril, and only for flexbox-capable browsers.

Demo

mithril-timepicker at flems.io

Installation

via npm:

$> npm install mithril-timepicker

You'll want to bring in either src/style.sass or src/style.css, depending on your workflow.

Usage

const TimePicker = require('mithril-timepicker')

// make a reference to an object with {h, m}
const myTime = { 
    h: mySpecialDate.getHours(), 
    m: mySpecialDate.getMinutes() 
}

m(TimePicker, {
    time: myTime, // time passed in MUST be a reference, not a literal
    onchange: ({h, m}) => {
        mySpecialDate.setHours(h, m, 0, 0)
    })     
})

// if you want to wipe the slate clean
TimePicker.reset(myTime)

API

attrs to pass to the component instance:

ATTRIBUTETYPERequired?DESCRIPTION
timeObject referenceYES{h, m} e.g. { h: 23, m: 59 }. Hour is always 0-23
tfhBooleanno24-hour time, defaults to false
incrementIntno5- or 15- minute options per hour, defaults to 5
onchangeFunctionnoHandler. Receives { h, m } as its argument

Theming

You can change the appearance easily by editing either style.css or style.sass, whichever fits your workflow. If you're using SASS, you can make a few quick UI changes based on variables at the top of the document.

0.9.2

6 years ago

0.9.1

6 years ago

0.9.0

6 years ago

0.8.2

6 years ago

0.8.1

6 years ago

0.8.0

6 years ago