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 🙏

© 2026 – Pkg Stats / Ryan Hefner

mgsmu-react-calendar

v0.0.6

Published

Calendar component with minimal global state management

Readme

mgsmu-react-calendar - Minimal Global State Management Utility

mgsmu-react-calendar is a lightweight, fully TypeScript-compatible React calendar component. It provides a flexible, locale-aware calendar with week numbers, selectable days, and customizable date formatting. Unlike heavy calendar libraries, mgsmu-calendar is simple, minimal, and easy to integrate into any React project.

Features

  • Lightweight & fast — minimal dependencies.
  • Locale support — 'de' (German) and 'en' (English) built-in.
  • Week numbers — ISO 8601 week numbering.
  • Selectable days — click a day to trigger a callback.
  • Date formatting — configurable short or full formats.
  • Due date calculation — easily determine if a date is today, upcoming, overdue, etc.
  • Global state integration — works seamlessly with mgsmu-react for shared state management.

Dependencies

mgsmu-react-calendar relies on mgsmu-react for lightweight global state management. It uses mgsmu-react’s pub-sub mechanism to store and update calendar state across components.

If you haven’t installed it yet, you can add it with:

npm install mgsmu-react
# or
yarn add mgsmu-react

install

npm install --save mgsmu-react-calendar
# or 
yarn add mgsmu-react-calendar

Usage in any component

import { useEffect, useState } from "react";
import Calendar from 'mgsmu-react-calendar';
import { useStateStore } from 'mgsmu-react'; //global State Management, e.g. if Header of button are used in different components
import 'mgsmu-react-calendar/calendar.css';

const Example = () => {
  const [calendarVal, setCalendarVal, removeCalendarVal] = useStateStore("calendar");
  const [open, setOpen] = useState<boolean | undefined>(undefined);

  const clicked = (entry: string) => { //do stuff with clicked date (optionally)
    console.log("clicked", entry);
  };

  useEffect(() => {//open Calendar on mount
    if (!calendarVal) {
      setOpen(true);
      return;
    }
  }, [calendarVal]);

  const swipe = (dir: 'prev' | 'next') => {
    if (!calendarVal) return;
    setCalendarVal({ ...calendarVal, changeMonth: true, dir });
  };

  return (
    <div className="page">
      <div className="calendar-title-row">
        <div>{calendarVal?.title}</div>
        <div onClick={() => swipe('prev')}>prev</div>
        <div onClick={() => swipe('next')}>next</div>
      </div>
      {calendarVal?.selectedDate && <div>selected: {calendarVal.selectedDate}</div>}
      {calendarVal?.dueDateType && <div>{calendarVal.dueDateType}</div>}
      <Calendar clicked={clicked} open={open} lang={'de'} />
    </div>
  );
};

export default Example;

Styling

You can customize the appearance by overriding CSS variables in your global styles:

:root {
  --calendar-title-row-bck-clr: lightcoral;
  --kw-txt-clr: blue;
  --weekday-txt-clr: darkgoldenrod;
  --border-color: black;
  --field-width: 50px;
  --field-height: 50px;
  --days-font-weight: 500;
  --days-font-size: 110%;
  --days-border-color: transparent;
  --days-border-width: 4px;
}

CalendarValues

The CalendarValue holds the following data, which can be used in Parent Components

interface CalendarVal {
  calOpen: boolean;
  entryMonth: number; //default currentMonth
  entryYear: number; //default currentYear
  lang: string; //default 'de'
  title: string;
  selectedDate?: string;
  dueDateType?: string;
  changeMonth?: boolean;
  dir?: 'prev' | 'next';
}

Due Date Types

The calcDateDiff helper returns one of the following strings to indicate the status of a date relative to today:

  • useable as external fn
import { calcDateDiff } from 'mgsmu-react-calendar';
const dueDateType = calcDateDiff(date);

| Type | Meaning | | -------------------- | ------------------------------------------------------------ | | due-today | The date is today. | | upcoming | The date is within the next 7 days (exclusive of today). | | future | The date is more than 7 days in the future. | | overdue | The date is past and up to 3 days late. | | long-overdue | The date is past and between 4 and 25 days late. | | critically-overdue | The date is past and more than 25 days late. | | unknown | Any date that cannot be classified, e.g., invalid input. |

Date Formating

Formats a date into DD.MM.YYYY (de) or MM/DD/YYYY (en) format.

import { formatToDateFormat } from 'mgsmu-react-calendar';
const dueDateType = formatToDateFormat( 
  input: string | Date,
  short = false, //optionally returns a short format (omitting the year if it's the current year)
  lang: 'de' | 'en' = 'en'
);

Changelog

All notable changes to this project will be documented in this file.