Have ideas to improve npm?Join in the discussion! »

    @vkbansal/react-date-primitives
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.0 • Public • Published

    React Date Primitives

    Primitives for creating Date-Picker and DateRange-Picker components in React with zero dependencies!

    NPM version Build Status

    Installation

    This package is distributed via npm.

    npm install --save react-date-primitives

    This package also depends on react. Please make sure you have those installed as well.

    Usage

    import * as React from 'react';
    import { CalendarMonth } from 'react-date-primitives';
    
    class SimpleDatePicker extends React.Component {
        render() {
            return (
                <table>
                    <CalendarMonth
                        month={new Date()}
                        render={({ days }) => (
                            <tbody>
                                {days.map((week, i) => (
                                    <tr key={i}>
                                        {week.map((day, j) => (
                                            <td key={`${i}-${j}`}>
                                                {day.inCurrentMonth ? day.date.getDate() : ''}
                                            </td>
                                        ))}
                                    </tr>
                                ))}
                            </tbody>
                        )}
                    />
                </table>
            );
        }
    }

    Live Examples

    API

    License

    MIT. Copyright(c) Vivek Kumar Bansal

    Install

    npm i @vkbansal/react-date-primitives

    DownloadsWeekly Downloads

    0

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    50.7 kB

    Total Files

    32

    Last publish

    Collaborators

    • avatar