🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@acusti/date-picker

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@acusti/date-picker

React component that renders a date picker with support for date ranges

Source
npmnpm
Version
0.8.0
Version published
Maintainers
1
Created
Source

@acusti/date-picker

latest version bundle size downloads per month supply chain security

A group of React components and utils for rendering a date picker with support for ranges via a two-up month calendar view.

See the storybook docs and demo to get a feel for what it can do.

Usage

npm install @acusti/date-picker
# or
yarn add @acusti/date-picker

Example

To render a two-up date picker for selecting date ranges, handling date selections via the onChange prop and showing months using abbreviations:

import { DatePicker } from '@acusti/date-picker';
import { useCallback, useState } from 'react';

function Popover() {
    const [dateRangeStart, setDateRangeStart] = useState<null | string>(
        null,
    );
    const [dateRangeEnd, setDateRangeEnd] = useState<null | string>(null);

    const handleDateRangeChange = useCallback(({ dateEnd, dateStart }) => {
        setDateRangeStart(dateStart);
        if (dateEnd) {
            setDateRangeEnd(dateEnd);
        }
    }, []);

    return (
        <DatePicker
            isRange
            isTwoUp
            onChange={handleDateRangeChange}
            useMonthAbbreviations
        />
    );
}

Props

This is the type signature for the props you can pass to DatePicker:

type Props = {
    className?: string;
    dateEnd?: Date | string | number;
    dateStart?: Date | string | number;
    initialMonth?: number;
    isRange?: boolean;
    isTwoUp?: boolean;
    monthLimitFirst?: number;
    monthLimitLast?: number;
    onChange: (payload: { dateEnd?: string; dateStart: string }) => void;
    useMonthAbbreviations?: boolean;
};

Keywords

react

FAQs

Package last updated on 19 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts