All Projects → ripjar → Material Datetime Picker

ripjar / Material Datetime Picker

Licence: other
A material design date-time picker for the web

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Material Datetime Picker

Dcalendar
JQuery calendar plugin plus date picker for input fields.
Stars: ✭ 22 (-90.76%)
Mutual labels:  material-design, date-picker
Motion Shapeofview
Explain how to use MotionLayout with ShapeOfView
Stars: ✭ 236 (-0.84%)
Mutual labels:  material-design
Vuejs Datepicker
A simple Vue.js datepicker component. Supports disabling of dates, inline mode, translations
Stars: ✭ 2,529 (+962.61%)
Mutual labels:  date-picker
Pokemonapp
Pokemon App with animations and beautiful UI
Stars: ✭ 228 (-4.2%)
Mutual labels:  material-design
Prismatic Night
A dark themed startpage and dark themes for Firefox and Linux inspired by Material design and Adapta.
Stars: ✭ 223 (-6.3%)
Mutual labels:  material-design
Hexo Theme Fluid
🌊 一款 Material Design 风格的 Hexo 主题 / An elegant Material-Design theme for Hexo
Stars: ✭ 3,700 (+1454.62%)
Mutual labels:  material-design
Material Backdrop
A simple solution for implementing Backdrop pattern for Android
Stars: ✭ 221 (-7.14%)
Mutual labels:  material-design
Materialchipsinput
Implementation of Material Design Chips component for Android
Stars: ✭ 2,605 (+994.54%)
Mutual labels:  material-design
Wallpaperboard
Android Json based wallpaper dashboard library
Stars: ✭ 235 (-1.26%)
Mutual labels:  material-design
Phonograph
A material designed music player for Android
Stars: ✭ 2,595 (+990.34%)
Mutual labels:  material-design
Vuebase
Building Vuebase : a Firebase-like theme : https://vuebase-theme.firebaseapp.com built with Vue and Vuetify (https://vuetifyjs.com)
Stars: ✭ 227 (-4.62%)
Mutual labels:  material-design
Wanandroid
WanAndroid客户端,项目基于 Material Design + MVP +dagger2 + RxJava + Retrofit + Glide + greendao 等架构进行设计实现,极力打造一款 优秀的玩Android https://www.wanandroid.com 客户端,是一个不错的Android应用开发学习参考项目
Stars: ✭ 223 (-6.3%)
Mutual labels:  material-design
Nice Spinner
A nice spinner for Android
Stars: ✭ 2,643 (+1010.5%)
Mutual labels:  material-design
Angular Ngrx Material Starter
Angular, NgRx, Angular CLI & Angular Material Starter Project
Stars: ✭ 2,623 (+1002.1%)
Mutual labels:  material-design
Musicplayer
A music player with pretty ui/ux design.
Stars: ✭ 232 (-2.52%)
Mutual labels:  material-design
Customfloatingactionbutton
This view is for replacement of standard Floating Action Button from Google Support Library. It is easy to use, customizable and you can also add text to button
Stars: ✭ 222 (-6.72%)
Mutual labels:  material-design
Togglebuttonlayout
Easy creation and management of toggle buttons on Android from the Material Design spec.
Stars: ✭ 225 (-5.46%)
Mutual labels:  material-design
Angularmaterialfirebase
🔥 Full stack starter app with Angular 8, Material Design and Firebase (+ demo)
Stars: ✭ 229 (-3.78%)
Mutual labels:  material-design
Diagonallayout
With Diagonal Layout explore new styles and approaches on material design
Stars: ✭ 2,591 (+988.66%)
Mutual labels:  material-design
Alyle Ui
Minimal Design, a set of components for Angular 9+
Stars: ✭ 234 (-1.68%)
Mutual labels:  material-design

Material Datetime Picker

A Material Design date/time picker modal, built for the web. Works well with Materialize, or standalone.

https://ripjar.github.io/material-datetime-picker/

Status Package

Time Time

Installation

npm install material-datetime-picker

Dependencies

The picker depends on Google's Material Design icons (packaged with Materialize), or included in the head of the document;

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

For best results also include Google's Material Font Roboto;

<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>

If you want to use this project as a standalone <script>, you can use dist/material-datetime-picker.js. You'll need to include moment.js and rome.js as well:

<script src="https://cdnjs.cloudflare.com/ajax/libs/rome/2.1.22/rome.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.js"></script>
<script src="material-datetime-picker.js" charset="utf-8"></script>

Usage

Manual (recommended)

The picker can be instantiated and interacted with manally;

import MaterialDateTimePicker from 'material-datetime-picker';

const picker = new MaterialDateTimePicker()
    .on('submit', (val) => console.log(`data: ${val}`))
    .on('open', () => console.log('opened'))
    .on('close', () => console.log('closed'));

document.querySelector('.c-datepicker-btn')
    .on('click', () => picker.open());        

As form input

The picker is decoupled from any single form element for simplicity. However, it should be simple to link the picker to a form input or button. For instance, given the input element <input class="c-datepicker-input" />, the following could be written;

import MaterialDateTimePicker from 'material-datetime-picker';

const input = document.querySelector('.c-datepicker-input');
const picker = new MaterialDateTimePicker()
    .on('submit', (val) => {
      input.value = val.format("DD/MM/YYYY");
    });

input.addEventListener('focus', () => picker.open());      

Options

All options are optional, including the el.

{
    // DOM Element to attach the datepicker. This element will receive 
    // events when the data changes. If an input element, will be 
    // populated with formatted date and time chosen.
    // `el` must be a DOM Element object. Selectpr strings or wrappers
    // like a jQuery selection are not supported.
    el: document.querySelector('.c-datepicker-btn'),
    // if `el` is set, the format used to display the datetime in the input, 
    format: 'DD/MM/YY', 
    //  the default value of the picker
    default: moment(),
    // the container to append the picker. If you change this, you need to make
    // sure your element has a z-index > 0 so that it displays in front of the scrim.
    container: document.body,    
    // cosmetic classes that can be overriden
    // mostly used for styling the calendar
    styles: {
        scrim: 'c-scrim',
        back: 'c-datepicker__back',
        container: 'c-datepicker__calendar',
        date: 'c-datepicker__date',
        dayBody: 'c-datepicker__days-body',
        dayBodyElem: 'c-datepicker__day-body',
        dayConcealed: 'c-datepicker__day--concealed',
        dayDisabled: 'c-datepicker__day--disabled',
        dayHead: 'c-datepicker__days-head',
        dayHeadElem: 'c-datepicker__day-head',
        dayRow: 'c-datepicker__days-row',
        dayTable: 'c-datepicker__days',
        month: 'c-datepicker__month',
        next: 'c-datepicker__next',
        positioned: 'c-datepicker--fixed',
        selectedDay: 'c-datepicker__day--selected',
        selectedTime: 'c-datepicker__time--selected',
        time: 'c-datepicker__time',
        timeList: 'c-datepicker__time-list',
        timeOption: 'c-datepicker__time-option',
        clockNum: 'c-datepicker__clock__num'
    },
    // date range to allow (see rome validator factories)
    dateValidator: null       
}

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].