Skip to content

A simple, lightweight hook that returns and updates the current date

License

Notifications You must be signed in to change notification settings

hxf31891/react-use-current-date

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

useCurrentDate - a custom React hook

A lightweight package containing a simple hook to track current date

Install

npm install react-use-current-date

Example

import React from "react";
import { useWindowSizes } from "react-use-current-date";

function MyApp() {
  const {
    date,
    mmddyyyy,
    ddmmyyyy,
    month,
    year,
    day,
    dayName,
    monthName,
    dmdy
  } = useCurrentDate();
  console.log(
    date,
    mmddyyyy,
    ddmmyyyy,
    month,
    year,
    day,
    dayName,
    monthName,
    dmdy
  );
}

About

A simple, lightweight hook that returns and updates the current date

Resources

License

Stars

Watchers

Forks

Packages