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

french-date-picker

v1.1.4

Published

Date picker for your React app with custom return values and custom style

Downloads

3

Readme

FRENCH DATE PICKER

This lib has been created to be used in french with a week starting on monday.
Cette lib a été crée pour être utilisée en français avec une semaine commençant le lundi

Features / Fonctionnalités

  • [x] Date selection with a calendar display
  • [x] Navigation
    • To the current day
    • Between months
    • Between years
    • Between decades
  • [x] Customization of colors
    • Background color
    • Text color
    • Icon color
  • [x] Usage in all forms
    • Controlled Form: returns the value via a setDateState() function
    • Uncontrolled Form: returns the value via the input's name and a useRef associated with a form in your parent component.
  • [x] Date return formats:
    • ZuluString in UTC+00 to ignore potential time zone offsets
    • String in 'yyyy-MM-dd' format for string fields
    • LocaleUtc for date fields with local time
    • Number for number fields with a timestamp

  • [x] Sélection de la date sur un affichage calendaire
  • [x] Navigation
    • au jour J
    • entre les mois
    • entre les années
    • entre les décennies
  • [x] Personnalisation des couleurs
    • Couleur de fond
    • Couleur de texte
    • Couleur des icônes
  • [x] Utilisation dans tous les formulaires
    • Controlled Form : renvoie de la valeur via une fonction setDateState()
    • Uncontrolled Form : renvoie de la valeur via le name de l'input un useRef associé à un form dans votre composant parent
  • [x] Renvoi de la date au format :
    • ZuluString string avec la date en Zulu pour ne pas tenir compte des potentiels décalages horaires
    • String string dans un format 'yyyy-MM-dd' pour les champs de type String
    • LocaleUtc objet de type date pour les champs de type date avec heure locale
    • Number nombre pour les champs de type nombre avec un timestamp

Installation

npm install french-date-picker

Usage

const App = () => {
    const [date, setDate] = React.useState <any>(null);
    useEffect(() => {
        console.log(date, typeof date);
    }, [date]);
    return (
        <>
            <h1>Date Picker Works</h1>
            <DatePicker
                mainColor={'#e19f2e'}
                backgroundColor={'#731d48'}
                textColor={'#bbe0e3'}
                labelText={'Date'}
                inputName={'date'}
                isRequired={true}
                setDate={setDate}
                returnFormat={'zuluString'}
            />
        </>
    )
}
const App = () => {
  const formRef = useRef<HTMLFormElement>(null);
  const handleSubmit = (event: any) => {
    event.preventDefault();
    let formData = new FormData(formRef.current!);
    console.log(...formData);
  }
  return (
          <>
            <h1>Date Picker Works</h1>
            <form ref={formRef} onSubmit={handleSubmit}>
              <DatePicker
                      mainColor={'#110A47FF'}
                      backgroundColor={'#c0cac3'}
                      textColor={'#000'}
                      labelText={'Date'}
                      inputName={'date'}
                      isRequired={true}
                      returnFormat={'number'}
              />
              <button>Submit</button>
            </form>
          </>
  )
}

Props

There is an interface for the props, you can use it to see the different props available : interface DatePickerProps contains :

  • textColor: string, (hexadecimal color)
  • backgroundColor: string, (hexadecimal color)
  • mainColor: string, (hexadecimal color)
  • labelText: string,
  • inputName: string, (will be use to get the value in an uncontrolled form)
  • isRequired: boolean,
  • returnFormat: string, (this value is one of the following values : zuluString, string, localeUtc, number)
  • setDate?: Dispatch<SetStateAction> (this is the optionnal function if you want to use a controlled form)

Il y a une interface pour les props, vous pouvez l'utiliser pour voir les différentes props disponibles : l'interface DatePickerProps contient :

  • textColor: string, (couleur hexadécimale)
  • backgroundColor: string, (couleur hexadécimale)
  • mainColor: string, (couleur hexadécimale)
  • labelText: string,
  • inputName: string, (sera utilisé pour récupérer la valeur dans un formulaire non contrôlé)
  • isRequired: boolean,
  • returnFormat: string, (cette valeur est une doit contenir l'une des valeurs suivantes : zuluString, string, localeUtc, number)
  • setDate?: Dispatch<SetStateAction> (c'est la fonction optionnelle si vous voulez utiliser un formulaire contrôlé)

Style

Style is wrapped in a block with the class .date-picker, you can use it to override it locally as needed. You must use the css file provided in the lib to have the correct style Font family is not included in the css file, you can use the one you want input is displayed as a block and will take 100% of the width of its container


Le style est englobé dans un bloc ayant pour class .date-picker, vous pouvez l'utiliser pour le surcharger localement selon vos besoins Vous devez utiliser le fichier css fourni dans la lib pour avoir le style correct La famille de police n'est pas incluse dans le fichier css, vous pouvez utiliser celle que vous voulez l'input est affiché en block et prendra 100% de la largeur de son conteneur

Dependencies / Dépendances