npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@commander-lol/react-kronos

v1.6.0

Published

A fast, intuitive, and elegant date and time picker for React.

Downloads

4

Readme

React Kronology

A fork of react-kronos

Build Status

A fast, intuitive, and elegant date and time picker for React.

Philosophy

  • Works straight out of the box with minimal props
  • Provide a few props and options that give lots of control
  • Allow for granular control when needed
  • Style is done in JS and can be easily modified
  • Beautiful code and appearance

Rationale

Even though there are many React Date and/or Time components, I'm developing my own because none of them do everything that I need.

Key requirements:

  • Separate date and/or time components (many only have date)
  • Easily style-able from JS (not have to muck around in the css)
  • Return multiple time formats (Date, Moment, ISO, string)
  • Lightweight, use no jquery
  • Active on focus, disappear on blur
  • Efficient keyboard navigation

Demo

Usage

  1. NPM install npm install @commander-lol/react-kronos
  2. Require Kronos import Kronos from '@commander-lol/react-kronos'
  3. Use
<Kronos
  date={this.state.datetime}
  onChange={this.onChange}
/>

Props:

  • date - Date(), Moment(), ISO, or string (if string, must match format)
  • time - Date(), Moment(), ISO, or string (if string, must match format)
  • timeStep - number : minutes for time step (if not specified: 30 minutes)
  • format - string : Moment formatting of date / time
  • onChange - function : native onChange method
  • onChangeDateTime - function : change method called when there is a new value
  • returnAs - string : onChange format JS_DATE, MOMENT, ISO, STRING (default: same as input)
  • min - Date(), Moment(), ISO to set as the minimum datetime
  • max - Date(), Moment(), ISO to set as the maximum datetime
  • minTime - Date(), Moment(), ISO to set as the minimum time (only the time will be used)
  • maxTime - Date(), Moment(), ISO to set as the maximum time (only the time will be used)
  • closeOnSelect - boolean : closes the dropdown when a value is selected (default: true)
  • closeOnBlur - boolean : closes the dropdown when the field is blurred (default: true)
  • disabled - boolean : whether or not the input component is disabled. If true, the selector will not be visible regardless of the setting of visible
  • shouldTriggerOnChangeForDateTimeOutsideRange - boolean: optionally allow dates outside min/max range to trigger onChanges (default: false)
  • preventClickOnDateTimeOutsideRange - boolean: optionally prevent users from clicking on dates outside min/max range (default: false)
  • hideOutsideDateTimes - boolean: optionally hide times that do not pass validation (default: false)
  • placeholder - string : placeholder text when there is no value
  • name - string : name used for the input form
  • disabled - boolean : prevent interaction with input field
  • inputStyle - object : inline styles for input field
  • inputClassName - string : .class for input field
  • inputId - string : #id for input field
  • calendarStyle - object : inline styles for calendar
  • calendarClassName - string : .class for calendar
  • options:
    • color - string : the highlight color in the UI as a hex
    • corners - number : the pixel size of rounded corners (default: 4)
    • font - string : the font family (default: Source Sans Pro)
    • locale - object : Moment locale customization
      • lang - string : language (default: en for english)
      • settings - object : properties to override as an object (default: { week: { dow: 1 }, weekdaysMin: ['M', 'T', 'W', 'T', 'F', 'S', 'S'] })
    • format: - object : Moment formatting for cell titles
      • today: - string : default: Today
      • year: - string : default: YYYY
      • month: - string : default: MMM
      • day: - string : default: D
      • hour: - string : default: h:mm a

Construction progress

Roadmap

Needed

  • Provide docs on website
  • options:
    • date (restrict calendar to show only days, or with months, or with years)
    • time (set increments, set ranges of time)
  • support for connected start & end date+time
    • date (show range on calendar)
    • time (show "0 hours", "0.5 hours", "1 hour", &c)

Ideas

  • input field masking
  • ⇧+arrow uses the higher order unit
  • specify required props & non-required (what happens if none are included)
  • add warning messages to help use component properly
  • mobile support
  • wide browser compatibility
  • prop: styles - granular styling (overwrite any style, or provide entire theme)
  • add crazy awesome date/time interpretation/parsing similar to that in The Hit List
  • set up solid unit tests

Thanks

  • !!! gaearon big thanks to Dan Abramov who has built some incredible react components (hot-loader, dnd), written excellent articles, and answered many questions
  • ! vjeux leading the CSS in JS movement