1.1.4 • Published 1 year ago

@phungvansyhb/vietnamese-lunar-date-picker v1.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Lunar Date Calendar Component

A React component library for displaying and selecting dates with both solar (Gregorian) and lunar calendar support, specifically designed for Vietnamese lunar calendar calculations.

Preview

I, Lunar Date picker

Lunar Date Picker

II, Lunar Date calendar

Lunar Date Calendar

Features

  • Display both solar and lunar dates
  • Support for Vietnamese holidays and events
  • Customizable date selection
  • Responsive calendar grid layout
  • Support for date range restrictions
  • Event indicators for special dates
  • Localization support

Usage example

    import '@phungvansyhb/vietnamese-lunar-date-picker/dist/styles.css';
    import { 
    LunarDatePicker,
    LunarCalendar,
    VietNameseEvents,
    LunarDate,
    SolarDate } 
    from '@phungvansyhb/vietnamese-lunar-date-picker';

    function App() {
        console.log(VietNameseEvents)
        console.log('lunar date', new SolarDate(new Date()).toLunarDate())
        return (
            <>
                <div style={{ width: '360px'}}>
                    <LunarDatePicker />
                </div>
                <div style={{ width: '1000px' }}>
                        <LunarCalendar />
                </div>
            
            </>
        );
    }

    export default App;

Props

I, Lunar date picker props

PropTypeDefaultDescription
valueDateundefinedSelected date
onChange(date: Date) => voidundefinedCallback when date is selected
valueFormatstring'DD/MM/YYYY'Format of the displayed date value
labelstring'Date'Label text for the input field
inputNamestring'date'Name attribute for the input field
requiredbooleantrueWhether the input is required
calendarIconReactNodeCustom calendar icon component
showLunarDatebooleantrueShow lunar date
lunarFormat'name' | 'number''number'Format of lunar date display
localeOptionsIntl.DateTimeFormatOptions{ weekday: 'narrow', month: 'long', year: 'numeric' }Date format options
showTodaybooleantrueHighlight today's date
localestring'vi'Locale for date formatting
maxDateDateundefinedMaximum selectable date
minDateDateundefinedMinimum selectable date

II, Lunar Calendar props

PropTypeDefaultDescription
valueDateundefinedSelected date
onChange(date: Date) => voidundefinedCallback when date is selected
showLunarDatebooleantrueShow lunar date
lunarFormat'name' | 'number''number'Format of lunar date display
localeOptionsIntl.DateTimeFormatOptions{ weekday: 'narrow', month: 'long', year: 'numeric' }Date format options
showTodaybooleantrueHighlight today's date
localestring'vi'Locale for date formatting
maxDateDateundefinedMaximum selectable date
minDateDateundefinedMinimum selectable date
events{ type: 'anually' | 'once', date: Date, content: string, isLunar: boolean }[]VietNameseEventsArray of events to display on calendar

Dependencies

  • React
  • dayjs
  • @nghiavuive/lunar_date_vi

License

MIT

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago