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

kohnoa-date-picker

v1.1.4

Published

**_DatePicker_** - UI react component for working with various types of calendar.

Downloads

41

Readme

Date Picker

DatePicker - UI react component for working with various types of calendar.

Demo

Online demo

Technologies

Installation

$ yarn add kohnoa-date-picker
$ npm install kohnoa-date-picker

Example

import { DatePicker } from 'kohnoa-date-picker';

export default function Example() {
  return (
    <DatePicker
      range
      initialStartDate={new Date(2024, 1, 1)}
      initialEndDate={new Date(2024, 1, 12)}
      onChange={(value: string) => {}}
    />
  );
}

Documentation

Initial Dates

You can pass initial values.

  • Simple Date Picker - If the start date is less than the minimum, then it will be redefined and will be equal to the minimum date. Same with the maximum date. Also, if initialStartDate or initialEndDate is passed, they will be ignored.
  • Range Date Picker - If the start date is greater than the end date, then they will swap places. If the start date is less than the minimum, then it will be redefined to the minimum date. Likewise with the end date and maximum value. Also, if initialDate is passed, this value will be ignored.
import { DatePicker } from 'kohnoa-date-picker';

export default function Example() {
  return (
    <DatePicker initialDate={new Date(2024, 1, 1)} />
    {/* or for range date picker */}
    <DatePicker
      range
      initialStartDate={new Date(2024, 1, 1)}
      initialStartDate={new Date(2024, 1, 10)}
    />
  );
}

Custom Theme

You can change the theme of the DatePicker component

import { DatePicker } from 'kohnoa-date-picker';

const customTheme = {
  input: {
    label: '#333333',
    placeholder: '#BBBBBB',
  },
  calendar: {
    text: '#333333',
    icons: '#333333',
  }
};

export default function Example() {
  return <DatePicker customTheme={customTheme} />;
}

Possible theme settings

export interface CustromThemeType {
  input: {
    placeholder: string,
    text: string,
    icons: string,
    background: string,
    border: string,
    error: string,
  },

  calendar: {
    background: string,
    border: string,
    text: string,
    icons: string,
    hover: string,
    cell: {
      active: string,
      range: string,
      holiday: string,
      indicator: string,
    },
  },

  todos: {
    backdrop: string,
    background: string,
    text: string,
    placeholder: string,
    icons: string,
    border: string,
    addButton: {
      text: string,
      background: string,
    }
  },

  general: {
    maxWidth: number,

    fontFamily: string,

    fontWeight: {
      lg: number,
      md: number,
      bl: number,
    }

    fontSizes: {
      lg: number,
      md: number,
      sm: number,
    },

    borderRadius: {
      high: number,
      low: number,
    },

    opacity: {
      low: string,
      high: string,
    },

    margin: {
      lg: number,
      sm: number,
    },

    duration: number,
  },
}

Format

Supported formats:

  • DD/MM/YYYY
  • MM/DD/YYYY
import { DatePicker } from 'kohnoa-date-picker';

export default function Example() {
  return <DatePicker format="MM/DD/YYYY" />;
}

Range

Get DatePicker with range selection. By default is false.

import { DatePicker } from 'kohnoa-date-picker';

export default function Example() {
  return <DatePicker range />;
}

Min and Max

You can limit the date selection range. If the minimum value exceeds the maximum, they will swap places.

import { DatePicker } from 'kohnoa-date-picker';

export default function Example() {
  return <DatePicker min={new Date(2024, 1, 1)} max={new Date(2024, 1, 10)} />;
}

View

You can customize the calendar view. By week, month or with the ability to switch by year.

  • week - Includes weekly view.
  • month (default) - Includes monthly view.
  • year - Enables display of additional buttons to navigate by year.
import { DatePicker } from 'kohnoa-date-picker';

export default function Example() {
  return (
    <DatePicker view='week' />
    {/* or */}
    <DatePicker view='month' />
    {/* or */}
    <DatePicker view='year' />
  );
}

Week start

You can set the start of the week from Monday or Sunday. Supported options:

  • monday
  • sunday (default)
import { DatePicker } from 'kohnoa-date-picker';

export default function Example() {
  return (
    <DatePicker weekStart="sunday" />
    {/* or */}
    <DatePicker weekStart='monday' />
  );
}

Show holidays

Enable holiday display. By default is disabled.

import { DatePicker } from 'kohnoa-date-picker';

export default function Example() {
  return <DatePicker showHolidays />;
}

Show weekends

Manage holiday display. By default is true

import { DatePicker } from 'kohnoa-date-picker';

export default function Example() {
  return <DatePicker showWeekends={false} />;
}