Lunar Date Picker
Convert calendar dates in Vietnam time.
Preview
The Code tab uses the common @/* alias. Import the copied file from the directory in vnui.json if your app uses a different path.
Installation
Initialize vn/ui in your app, then add this component.
npx @naminc/vnui@latest add lunar-date-pickerUsage and variants
Civil dates use UTC+7. The local table spans 1976–2099 and distinguishes leap months. Import gregorianToLunar and lunarToGregorian from the installed lib/lunar module for bidirectional conversion.
<LunarDatePicker min="2026-01-01" max="2026-12-31" defaultValue="2026-02-17" />API
| Prop | Type | Behavior |
|---|---|---|
value, defaultValue | string | Controlled value or initial uncontrolled value. |
onValueChange | (value) => void | Receives the next value; connect it to form state or React Hook Form Controller. |
label, name, disabled, className | string, string, boolean, string | Visible label, form name, disabled state and CSS class. |
value | string | Gregorian date, YYYY-MM-DD. |
min, max | string | Inclusive ISO date bounds within 1976–2099. |
Use value and onValueChange for controlled fields, including React Hook Form Controller. Use defaultValue for standalone fields. label, name, disabled and className customize the field.
Accessibility
Fields have visible labels and keyboard focus. Searchable selectors support typing, arrow keys, Enter and Escape; date controls use browser keyboard behavior.
An out-of-range date sets aria-invalid and explains the allowed range. The lunar editor reports invalid day or leap-month combinations inline.