@tarzui/date-fns-be
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.8 • Public • Published

    Date-io adapter for Buddhist Era

    This project is a part of date-io for buddhist era

    Get more information here

    Examples

    display as buddhist era output value from date picker

    Install

    npm install @tarzui/date-fns-be

    or

    yarn add @tarzui/date-fns-be

    Usage example with @mui DatePicker

    import { useState } from 'react';
    import TextField from '@mui/material/TextField';
    import AdapterDateFns from '@tarzui/date-fns-be';
    import LocalizationProvider from '@mui/lab/LocalizationProvider';
    import DatePicker from '@mui/lab/DatePicker';
    import { format } from 'date-fns';
    import { th } from 'date-fns/locale';
    
    export default function MuiDatePickerBuddhistEra() {
      const [value, setValue] = useState(format(new Date(), 'yyyy-MM-dd').toString());
      console.log('value: ', value);
    
      return (
        <LocalizationProvider dateAdapter={AdapterDateFns} locale={th}>
          <DatePicker
            label='@tarzui/date-fns-be'
            value={value}
            onChange={(newValue) => {
              console.log('newValue: ', newValue);
              setValue(format(new Date(newValue), 'yyyy-MM-dd').toString());
            }}
            renderInput={(params) => <TextField {...params} />}
          />
        </LocalizationProvider>
      );
    }

    Install

    npm i @tarzui/date-fns-be

    DownloadsWeekly Downloads

    41

    Version

    1.0.8

    License

    MIT

    Unpacked Size

    211 kB

    Total Files

    18

    Last publish

    Collaborators

    • tarzui