﻿# nf-date-picker {#date-picker}

Half-year and week-range pickers complement the missing Element Plus date types. Use native `ElDatePicker` types `week`, `quarter`, `quarterrange`, `year`, and `yearrange` for the other periods.

## Examples {#examples}

### 
```vue
<template>
  <div class="date-picker-examples">
    <NfHalfYearPicker v-model="half" value-format="YYYY-MM-DD" />
    <NfHalfYearRangePicker v-model="halves" value-format="YYYY-MM-DD" />
    <NfWeekRangePicker v-model="weeks" value-format="YYYY-MM-DD" />
    <pre>{{ { half, halves, weeks } }}</pre>
  </div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { NfHalfYearPicker, NfHalfYearRangePicker, NfWeekRangePicker } from '@94ai-plus/common-ui'
const half = ref<string | null>(null)
const halves = ref<string[] | null>(null)
const weeks = ref<string[] | null>(null)
</script>
<style scoped>
.date-picker-examples { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
pre { flex-basis: 100%; }
</style>
```

## Values {#values}

A half-year value is January 1 or July 1. Half-year ranges contain two sorted half-year start dates. Week ranges use the date-range panel to select two dates and expand to the first day of the first week and the last day of the last week at local midnight. Selecting within one week returns the full week. The week start follows the Element Plus locale; `weekStartsOn` overrides normalization.

Values are `Date` or `Date[]` by default; `valueFormat` returns formatted strings. Clearing returns `null`. Half-years are panel-only; `disabledDate` checks their start dates. Week ranges disable entire weeks containing unavailable days. Native year/quarter panels have four columns; each half-year spans two columns of a four-column grid. Week calendars retain seven days.

## Attributes {#attributes}

| Attribute | Description | Default |
| --- | --- | --- |
| modelValue / v-model | Bound value: Date / string / number / Array / null | null |
| type | Picker type: halfyear / halfyearrange / weekrange | halfyear |
| size | Size: small / default / large | default |
| disabled | Disabled | false |
| clearable | Allow clearing | true |
| placeholder / startPlaceholder / endPlaceholder | Single/range placeholders | — |
| format / valueFormat | Display/bound-value format (Day.js) | — |
| disabledDate | Disabled-date predicate: (date: Date) => boolean | — |
| defaultValue | Initial panel date: Date / [Date, Date] | — |
| weekStartsOn | Week start (0=Sunday, 1=Monday, …6=Saturday) | Element Plus locale |
| teleported / popperClass | Teleport to body / additional popup class | true / — |

## Events {#events}

| Attribute | Description |
| --- | --- |
| update:modelValue / change | Value update / completed selection |
| calendar-change | Range selection progress: date array, null for an unselected endpoint |
| visible-change | Popup visibility |
| clear / focus / blur | Clear / focus / blur |

## Methods {#methods}

`focus()` / `blur()` / `handleOpen()` / `handleClose()`: Focus / blur / open / close the panel.
