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 🙏

© 2025 – Pkg Stats / Ryan Hefner

r-datetime

v1.2.0

Published

A customizable and lightweight React Date Time Picker component with smooth UI, time zone support, and easy integration.

Readme

r-datetime

A customizable and lightweight React Date Time Picker component with a smooth UI, time zone support, and flexible configuration options. Ideal for modern React applications that require date, time, or date-time inputs with advanced features.

Demo

📦 Installation

npm install r-datetime

or

yarn add r-datetime

🚀 Quick Start

import React, { useState } from 'react';
import DateTimePicker from 'r-datetime';

const App = () => {
  const [selectedDate, setSelectedDate] = useState(null);

  return (
    <div className="app">
      <DateTimePicker onChange={(date) => setSelectedDate(date)} />
      {selectedDate && (
        <p>Selected: {selectedDate.toLocaleString()}</p>
      )}
    </div>
  );
};

🎨 Theming Options

Default Theme

Clean, minimalist design that works with any application.

<DateTimePicker onChange={(date) => setSelectedDate(date)} />

Light Theme with Custom Colors

Customize your picker with any color palette that matches your brand.

Light Theme Custom

<DateTimePicker
  onChange={(date) => setSelectedDate(date)}
  bodyColor="bg-gray-100"
  textColor="text-gray-800"
  buttonColor="bg-blue-600"
  iconColor="text-blue-500"
/>

Dark Theme

Perfect for dark-mode interfaces or night-time usage.

Dark Theme

<DateTimePicker
  onChange={(date) => setSelectedDate(date)}
  bodyColor="bg-black"
  textColor="text-gray-100"
  buttonColor="bg-purple-600"
  iconColor="text-purple-400"
/>

📅 Different Modes

Date-Time Mode (Default)

Select both date and time in one component.

<DateTimePicker onChange={(date) => setSelectedDate(date)} />

Date Only Mode

When you only need to collect a date.

Date Only Mode

<DateTimePicker
  onChange={(date) => setSelectedDate(date)}
  mode="date"
  buttonColor="bg-green-600"
/>

Time Only Mode

For time selection without dates.

Time Only Mode

<DateTimePicker
  onChange={(date) => setSelectedDate(date)}
  mode="time"
  buttonColor="bg-amber-600"
/>

🌍 Internationalization

Support for multiple languages and date formats to meet global user needs.

French Locale

<DateTimePicker
  onChange={(date) => setSelectedDate(date)}
  locale="fr-FR"
  dateFormat={{ day: "2-digit", month: "long", year: "numeric" }}
  timeFormat={{ hour: "2-digit", minute: "2-digit", hour12: false }}
  firstDayOfWeek={1} // Monday as first day
  buttonColor="bg-indigo-600"
/>

🎛️ Props

| Prop | Type | Default | Description | | ---------------------- | ---------------------------------------- | --------------- | --------------------------------------- | | mode | 'date' \| 'time' \| 'datetime' | 'datetime' | Choose picker mode | | onChange | (date: Date) => void | required | Callback on date/time selection | | bodyColor | string | bg-white | Tailwind class for body background | | textColor | string | text-black | Tailwind class for text color | | buttonColor | string | bg-blue-500 | Tailwind class for button color | | classname | string | py-4 | Customized layout of date/time selector | | iconColor | string | text-blue-500 | Tailwind class for icon color | | locale | string | en-US | Locale for formatting | | dateFormat | Intl.DateTimeFormatOptions | {} | Custom date format | | timeFormat | Intl.DateTimeFormatOptions | {} | Custom time format | | firstDayOfWeek | 0 \| 1 | 0 (Sunday) | First day of the week | | enableRangeSelection | boolean | false | Enable date range selection | | onRangeChange | (start: Date, end: Date) => void | undefined | Callback for range change | | initialEndDate | Date | undefined | Preselect end date in range mode | | minDate | Date | undefined | Minimum selectable date | | maxDate | Date | undefined | Maximum selectable date | | disabledDates | Date[] | [] | Dates to be disabled | | timeZone | string | User's TZ | IANA time zone (e.g., 'Europe/Paris') | | showTimeZoneSelector | boolean | false | Show time zone selector dropdown | | customPresets | { label: string, value: () => Date }[] | [] | Predefined date presets | | minuteInterval | number | 1 | Interval for time selection in minutes | | onHoverTextColor | string | black | Text color when hovering | | hoverColor | string | bg-gray-300 | Background color on hover |

🧪 Development & Testing

You can test your local changes using:

npm link
npm run build

Then in your test project:

npm link r-datetime

📘 License

MIT License

📌 Author & Repository