All Projects → CreaturesInUnitards → mithril-datepicker

CreaturesInUnitards / mithril-datepicker

Licence: MIT license
Pick a date! But only if you're using Mithril. (component for Mithril.js ^v1.0)

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to mithril-datepicker

Hibiscus.js
Native Angular directives for Bootstrap4
Stars: ✭ 115 (+400%)
Mutual labels:  widget, datepicker
mithril-materialized
A Materialize-css library for the Mithril framework.
Stars: ✭ 22 (-4.35%)
Mutual labels:  mithril, mithril-components
Yii2 Date Picker Widget
Bootstrap DatePicker Widget for Yii2
Stars: ✭ 128 (+456.52%)
Mutual labels:  widget, datepicker
Circularpicker
CircularPicker is helpful for creating a controller aimed to manage any calculated parameter.
Stars: ✭ 73 (+217.39%)
Mutual labels:  widget, datepicker
yii2-datetime-widgets
Datetime widgets for Yii2
Stars: ✭ 22 (-4.35%)
Mutual labels:  widget, datepicker
datePicker
时间选择器,包含年月、年月日、年月日时分秒、
Stars: ✭ 14 (-39.13%)
Mutual labels:  datepicker
flutter plugins
Flutter插件集合,好用常用的插件.
Stars: ✭ 22 (-4.35%)
Mutual labels:  widget
widgets
🚀 Dojo - UI widgets.
Stars: ✭ 82 (+256.52%)
Mutual labels:  widget
django-tabular-permissions
Display Django permissions in a HTML table that is translatable and easily customized.
Stars: ✭ 60 (+160.87%)
Mutual labels:  widget
nhl-my-team-ios-widget
"NHL-MyTeam" Scriptable iOS widget 🏒
Stars: ✭ 16 (-30.43%)
Mutual labels:  widget
range-slider
Customizable slider (range) component for JavaScript with no dependencies
Stars: ✭ 26 (+13.04%)
Mutual labels:  widget
TypePicker
A date picker use in web and react-native
Stars: ✭ 14 (-39.13%)
Mutual labels:  datepicker
flutter signature pad
📦 Flutter widget to allow users to sign with finger and export the result as image data.
Stars: ✭ 95 (+313.04%)
Mutual labels:  widget
stagtools
StagTools is a powerful plugin to extend functionality to your WordPress themes offering shortcodes, FontAwesome icons, and useful widgets.
Stars: ✭ 21 (-8.7%)
Mutual labels:  widget
wp-parsidate
Integrates the Solar Hijri (Persian) calendar in WordPress
Stars: ✭ 36 (+56.52%)
Mutual labels:  widget
flutter date picker
A Cupertino style date picker for Android and IOS
Stars: ✭ 78 (+239.13%)
Mutual labels:  datepicker
cl-bootstrap
Common Lisp web development widget library for Twitter's Bootstrap
Stars: ✭ 16 (-30.43%)
Mutual labels:  widget
s-date-range-picker
📅 A date range picker built with Svelte
Stars: ✭ 13 (-43.48%)
Mutual labels:  datepicker
now-playing-profile
Originally created by github.com/natemoo-re, a small Spotify widget suitable for your profile! Read the "spotify-setup-guide.md" to get started
Stars: ✭ 32 (+39.13%)
Mutual labels:  widget
a11yAccordion
An accessible and easy to use Accordeon widget.
Stars: ✭ 37 (+60.87%)
Mutual labels:  widget

mithril-datepicker

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

Demo

mithril-datepicker at flems.io

Installation

via npm:

npm install mithril-datepicker

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

Usage

var DatePicker = require('path/to/mithril-datepicker.js')
var myDate = new Date(someSpecialDateYouHaveInMind)

m(DatePicker, {
  date: myDate,
  onchange: function(chosenDate){
    // do your magic with your shiny new Date
  }
})

API

There are 2 optional attributes you can pass in via the component's attrs object:

  • date: a valid JS Date object. Defaults to the current date.
  • onchange: function to execute when a date is chosen. Receives the newly-chosen Date object 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 have a lot of quick-change UI based on variables at the top of the document.

Localization

mithril-datepicker features 2 flavors of L10n: global and per-instance. In both cases, the English default names for days of the week, months and the labels for the previous/next buttons can all be overridden, along with the week's starting day.

ATTRIBUTE TYPE DESCRIPTION
locale String BCP 47 language tag, eg. "fr" or "es". Defaults to "en-us"
weekStart Int 0-based weekday to present first, defaulting to 0 (Sunday)
prevNextTitles [String] Array of string labels for the prev/next increment buttons. Defaults to ["1 Mo", "1 Yr", "10 Yr"]
formatOptions Object hash for the components of the formatted date for output to the display. The tested options are weekDay, day, month, year. See the MDN docs for the possible values.

To globally set the language for all datepickers in your project:

var myOptions = {
	weekday: 'short',
	day: '2-digit',
	month: 'short',
	year: 'numeric'
}

DatePicker.localize({
  weekStart: 1, // Monday 
  locale: 'es',
  prevNextTitles: ['1 Me', '1 Añ', '10 Añ'],
  formatOptions: myOptions
})

To set the language for a single datepicker, overriding the default/global setting, pass attrs to the component:

m(DatePicker, {
  date: myDate,
  onchange: myOnchangeFn,
  weekStart: 0, // override the global we set above
  locale: 'fr',
  formatOptions: myOptions 
})
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].