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

tb-datepicker-js

v2.5.1

Published

A Simple Datepicker for JS libraries

Downloads

37

Readme

TB Datepicker JS

screenshot

Install

npm install tb-datepicker-js

Changelog

v2.0.0 Bug Fixes that were in Version 1 fixed
v2.1.0 Accessibility Added
v2.1.1 Show Day Buttons Option Added To Change Day + Or - 1 Day
v2.2.0 CSS Media Width Breaks Added
v2.2.1 CSS Media Width Breaks changed For Laptops And Desktops
v2.2.2 CSS Media Width Breaks changed For Laptops And Desktops
v2.3.0 Babel To Convert ES6 into ES5 
v2.3.1 Babel To Convert ES6 into ES5 And Minify 
v2.4.0 CSS media Query, CSS z-index On The datepicker And The Way The Date Format Is Passed
v2.4.1 CSS Media Width Breaks Added
v2.5.0 Accesibilty Changed, show or hide clear and close buttons, close on mouseleave

Accessibility

When Focused On A Datepicker
ctrl And c = Clear The Date
ctrl And x = Close The DatePicker
Arrow Left = Previous Month
Arrow Right = Next Month
Arrow Up = Next Day
Arrow Down = Previous Day

Options


    showDayChangeButtons: true
    close: true
    clear: true
    format: 'dd/mm/yyyy' or 'yyyy-mm-dd' required   
 
    

Setup

Copy The Installed dist directory in your node_modules folder for this package to your public directory
<script src="/dist/js/tb-datepicker.js"></script>
<link rel="stylesheet" href='/dist/css/tb-datepicker.css'> 

Tests

screenshot

How It Works
  By Adding A Unique id To An Input
  If A date picker Has No Value Then Todays Month And Year Will Be Selected When Opened
  See Examples Below In The JS section
  The datepicker JavaScript Uses My Package
  https://www.npmjs.com/package/tb-no-more-get-document-by-id
  This Means You Don't Have To Keep Writing document.getElementById('id1');
  You Can Then Concat A datepicker Function That Is Prototyped
   
HTML
    <link rel="stylesheet" href="/dist/css/datepicker.css">
    <script src="/dist/js/tb-datepicker.js"></script>
    
    <input type="text" class="tb-datepicker" style="margin-right: 100px" id="id1" value="12/11/2021">
    <input type="text" class="tb-datepicker" style="margin-right: 100px" id="id2" value="12/10/2021">
    <input type="text" class="tb-datepicker" style="margin-right: 100px" id="id3" value="12/09/2021">
    <input type="text" class="tb-datepicker" style="margin-right: 100px" id="id4" value="12/10/2021">
    <input type="text" class="tb-datepicker" style="margin-right: 100px" id="id5">

JS


    //create the datepickers
    $tb('#id1').datepicker({format: 'dd/mm/yyyy'});
    $tb('#id2').datepicker({format: 'dd/mm/yyyy'});
    $tb('#id3').datepicker({format: 'dd/mm/yyyy'});
    $tb('#id4').datepicker({format: 'dd/mm/yyyy'});
    $tb('#id5').datepicker({format: 'dd/mm/yyyy'});
 

Example

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
    <title>TB Datepicker</title>
    <script src="/dist/js/tb-datepicker.js"></script>
    <link rel="stylesheet" href="/dist/css/tb-datepicker.css">
    </head>

    <body>
        <input type="text" class="tb-datepicker" style="margin-right: 100px" id="id1" value="12/11/2021">
        <input type="text" class="tb-datepicker" style="margin-right: 100px" id="id2" value="01/02/2020">
        <input type="text" class="tb-datepicker" style="margin-right: 100px" id="id3" value="01/04/2021">
        <input type="text" class="tb-datepicker" style="margin-right: 100px" id="id4" value="12/10/2021">
        <input type="text" class="tb-datepicker" style="margin-right: 100px" id="id5">

    <script>
    
        //create the datepickers
        $tb('#id1').datepicker({ format: 'dd/mm/yyyy'});
        $tb('#id2').datepicker({ format: 'dd/mm/yyyy'});
        $tb('#id3').datepicker({ format: 'dd/mm/yyyy'});
        $tb('#id4').datepicker({ format: 'dd/mm/yyyy'});
        $tb('#id5').datepicker({ format: 'dd/mm/yyyy'});

    </script>
    </body>
</html>