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

uglydate

v1.0.6

Published

A JavaScript date range selector for everyone.

Downloads

5

Readme

UglyDate

A JavaScript date range selector for everyone.

UglyDate handles date ranges well and that's all. As a purpose specific component it will solve this one problem perfectly, without the bloat of extra code for unneeded features. UglyDate is inspired by the date selector on Google Flights.

Mobile

Desktop

Wow that's really ugly, can it look pretty?

Yep! Here are some examples that frontend developers were able to do in under a day:

Ticketing

Hotel Site

Features

  • Select a start and end date. Those can be the same day or different days.
  • On desktop provide a window to allow for two months to be viewed at the same time. This is a great pattern for things like hotel reservations, trips, and so on.
  • Mobile First. This component is designed with smaller devices in mind. On mobile we switch to an overlay mode that allows a user to choose a date without the need for hover states. On desktop mode UglyDate shows multiple months with a next/prev navigation.
  • Broadcast regular Input change events so the component can be tied into regular forms or other JS changes without additional configuration.

Getting Started

UglyDate is available via yarn and npm.

npm install uglydate

You can also download the minified file found in this repository.

Basic Usage

<div data-uglydate data-uglydate-large-screen-width="640">
	<input type="date" placeholder="Select A Date" min="2020-01-01" max="2020-01-01" data-uglydate-start-date />
	<input type="date" placeholder="Select A Date" min="2020-01-01" max="2020-01-01" min="2017-12-08" max="2018-12-06" data-uglydate-end-date />
</div>
  1. Add the data-uglydate attribute to an HTML node. Somewhere in that node's subtree must contain two input elements set to a type of date.
  2. Provide a data-uglydate-large-screen-width parameter, which tells UglyDate when to switch to desktop mode.
  3. Give the input elements data-uglydate-start-date and data-uglydate-end-date attributes respectively.
  4. Embed the library.
  5. When you're ready (at the bottom of the page, e.g.), write the following:
<script type="text/javascript">
	var ud = new UglyDate()
</script>

More specific examples can be found in the examples directory.

The Ugly Philosophy

  • Ship with an example CSS file, unminified. That theme is deliberately terrible - putrid colors and Comic Sans MS. The idea is that your design team is forced to focus on the theme, and thus improve the design quality of the site.

  • Build vanilla and focus on a single, simple problem. There are few options or additional parameters provided with this component, so that it solves just one thing right.

  • Place an emphasis on Progressive Enhancement. The component begins with raw, rendered HTML on the page and adjusts with JavaScript.

  • Expose the prototypes directory for those just starting out or curious. We don't just want to build the component in the open, we want to show how we figured out what works.