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

awesome-date-time

v1.0.13

Published

An easy to use date time picker with customizable approach

Downloads

8

Readme

Awesome Date-Time

Welcome to the documentation for Awesome Date-Time, a versatile and easy-to-use date-time picker component for React applications.

Installation

To install the package, use npm or yarn:

npm install awesome-date-time

or

yarn add awesome-date-time

Usage

Below is an example of how to use the DateTimePicker component in your React application.

Step 1: Import the Component

First, import the DateTimePicker component and the necessary CSS file:

import React, { useState } from "react";
import DateTimePicker from "awesome-date-time";

Step 2: Use the Component in Your Application

Here's a basic example of how to use the DateTimePicker component:

const App = () => {
  const [showPicker, setShowPicker] = useState(false);
  const [selectedDateTime, setSelectedDateTime] = useState("");

  const handleDateTimeChange = (dateTime) => {
    setSelectedDateTime(dateTime);
  };

  return (
    <div>
      <button onClick={() => setShowPicker(true)}>Select Date & Time</button>
      {showPicker && (
        <DateTimePicker
          show={showPicker}
          setShow={setShowPicker}
          selected={selectedDateTime}
          onChange={handleDateTimeChange}
        />
      )}
      <div>Selected Date-Time: {selectedDateTime}</div>
    </div>
  );
};

export default App;

Step 3: Customize the Component

You can customize the DateTimePicker component by passing various props:

  • show (bool, required): Determines whether the picker is visible.
  • hidePastDates (bool, optional, default: false): If true, past dates are hidden.
  • timeSlotGap (number, optional, default: 15): The gap between time slots in minutes.
  • bgColor (string, optional, default: 'white'): Background color of the picker.
  • fontSize (string, optional, default: '1.15rem'): Font size for dates & time slots.
  • selected (string, required): The currently selected date-time.
  • setShow (func, required): Function to control the visibility of the picker.
  • onChange (func, required): Function to handle date-time selection changes.

Here's an example with custom props:

<DateTimePicker
  show={showPicker}
  setShow={setShowPicker}
  selected={selectedDateTime}
  onChange={handleDateTimeChange}
  hidePastDates={true}
  timeSlotGap={30}
  bgColor="lightblue"
  fontSize="16px"
/>

Component Details

DateTimePicker Component

The DateTimePicker component allows users to select a date and time within a specified range. It provides an intuitive interface for navigating through months and selecting time slots.

Props

| Prop | Type | Required | Default | Description | | --------------- | ------ | -------- | ------- | ----------------------------------------------------- | | show | bool | yes | - | Controls the visibility of the picker. | | hidePastDates | bool | no | false | If true, past dates are hidden. | | timeSlotGap | number | no | 15 | The gap between time slots in minutes. | | bgColor | string | no | white | Background color of the picker. | | fontSize | string | no | 1.15rem | Font size for dates & time slots. | | selected | string | yes | - | The currently selected date-time. | | setShow | func | yes | - | Function to control the visibility of the picker. | | onChange | func | yes | - | Function to handle changes in the selected date-time. |

Refer here for Live Demo.


## Conclusion

The `awesome-date-time` package is a powerful and customizable date-time picker component for React applications. It offers a user-friendly interface and a variety of customization options to suit your needs.

For more information and detailed examples, please refer to the [GitHub repository](https://github.com/iahmadhabibx/awesome-date-time). If you encounter any issues or have questions, feel free to open an issue on GitHub.