Sha256: 6b69fcf9d60314336d14191fac6e2807bfee989856a28cdd001b0e1cffc8f778

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

import flatpickr from "flatpickr";
import {VTextField} from './text-fields';
import {MDCTextField} from '@material/textfield';


export function initDateTime() {
    console.log('\tDateTime');
    let components = document.querySelectorAll('.v-datetime');
    for (let i = 0; i < components.length; i++) {
        let component = components[i];
        if (!component.vComponent) {
            component.vComponent = new VDateTime(component, new MDCTextField(component));
        }
    }
}


export class VDateTime extends VTextField {
    constructor(element, mdcComponent) {
        super(element, mdcComponent);
        let config = JSON.parse(element.dataset.config);
        config.altInput = true;
        let type = element.dataset.type;

        if (type === 'datetime') {
            config.enableTime = true;
        } else if (type === 'time') {
            config.enableTime = true;
            config.noCalendar = true;
        }
        this.fp = flatpickr(this.input, config);
    }

    clear() {
        this.fp.clear();
    }
}



Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
voom-presenters-0.1.13 views/mdc/assets/js/components/datetime.js
voom-presenters-0.1.12 views/mdc/assets/js/components/datetime.js
voom-presenters-0.1.11 views/mdc/assets/js/components/datetime.js
voom-presenters-0.1.10 views/mdc/assets/js/components/datetime.js
voom-presenters-0.1.9 views/mdc/assets/js/components/datetime.js
voom-presenters-0.1.8 views/mdc/assets/js/components/datetime.js