# @xintao1105/date-time-picker

> !['示例图'](https://cdn.jsdelivr.net/npm/@xintao1105/date-time-picker@1.0.0/date-time-picker.gif) ## 安装

Latest version **1.0.1** (published 2023-09-21) · 0 weekly downloads

## Install

```sh
npm install @xintao1105/date-time-picker
pnpm add @xintao1105/date-time-picker
yarn add @xintao1105/date-time-picker
bun add @xintao1105/date-time-picker
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-09-21 |
| First published | 2023-09-21 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 97.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | zhangxt1105 |
| Keywords | date-time-picker, date-time, picker |

## Links

- npm: https://www.npmjs.com/package/@xintao1105/date-time-picker
- npm.io page: https://npm.io/package/@xintao1105/date-time-picker

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^18.2.0
- [react-dom](https://npm.io/package/react-dom.md) ^18.2.0
- [@feige0629/debug-console](https://npm.io/package/@feige0629/debug-console.md) ^0.1.3

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2023-09-21
- 1.0.0 — 2023-09-21

## README

!['示例图'](https://cdn.jsdelivr.net/npm/@xintao1105/date-time-picker@1.0.0/date-time-picker.gif)
## 安装

```bash
npm install @xintao1105/date-time-picker
```

or

```bash
yarn add @xintao1105/date-time-picker
```

## 示例代码

```ts
import DateTimePicker from '@xintao1105/date-time-picker';
import type { interProps } from '@xintao1105/date-time-picker';

const ars:interProps = {
    onClick: (e) => { console.log("onClick", e) }
  }

<DateTimePicker {...ars}/>
```

## 日期格式 + 时间格式参考示例
```ts
const dateFormat = [
  {
    name: "无",
    value: "",
  },
  {
    name: "2021年1月1日",
    value: "yyyy年M月d日",
  },
  {
    name: "2021年01月01日",
    value: "yyyy年MM月dd日",
  },
  {
    name: "2021-1-1",
    value: "yyyy-M-d",
  },
  {
    name: "2021-01-01",
    value: "yyyy-MM-dd",
  },
  {
    name: "2021.1.1",
    value: "yyyy.M.d",
  },
  {
    name: "2021.01.01",
    value: "yyyy.MM.dd",
  },
  {
    name: "2021/01/01",
    value: "yyyy/MM/dd",
  },
  {
    name: "2021/01",
    value: "yyyy/MM",
  },
  {
    name: "2021-01",
    value: "yyyy-MM",
  },
  {
    name: "2021.01",
    value: "yyyy.MM",
  },
  {
    name: "1月1日",
    value: "M月d日",
  },
  {
    name: "1-1",
    value: "M-d",
  },
  {
    name: "1.1",
    value: "M.d",
  },
  {
    name: "01.01",
    value: "MM.dd",
  },
  {
    name: "2021",
    value: "yyyy",
  },
  {
    name: "1月",
    value: "M月",
  },
  {
    name: "1日",
    value: "d日",
  },
];

timeFormat 时间格式类型
const timeFormat = [
  {
    name: "无",
    value: "",
  },
  {
    name: "8时0分0秒",
    value: "H时m分s秒",
  },
  {
    name: "8时0分",
    value: "H时m分",
  },
  {
    name: "8时",
    value: "HH时",
  },
  {
    name: "0分",
    value: "m分",
  },
  {
    name: "0秒",
    value: "s秒",
  },
  {
    name: "08:00:00",
    value: "HH:mm:ss",
  },
  {
    name: "08:00",
    value: "HH:mm",
  },
  {
    name: "08(时)",
    value: "HH(时)",
  },
];
```

## 参数类型

```ts
interface dataProps {
  startTime?: string;
  value?: string;
  endTime?: string;
}

export interface style {
  fontFamily?: string;
  fontSize?: number;
  color?: string;
  fontWeight?: string | number;
  letterSpacing?: number;
  lineHeight?: number;
  fontStyle?: string;
}

interface fillColor {
  startVal: string;
  endVal: string;
  direction: number;
}


export interface interProps {
  base?: {
    width: number;
    height: number;
  };
  /**
   * 日期格式
   * @default dateFormat = "yyyy-MM-dd"
   */
  dateFormat?: string;
  /**
   * 时间格式
   * @default timeFormat = "HH:mm:ss"
   */
  timeFormat?: string;
  /**
   * 起始时间 格式要求分隔符，且数据优先级大于此处设置
   * @default startTime = ""
   */
  startTime?: string;
  /**
   * 结束时间 格式要求分隔符，且数据优先级大于此处设置
   * @default endTime = ""
   */
  endTime?: string;
  /**
   * 交互方式 点击日期 | 点击确认按钮
   * @type {String}
   * @default interactiveType = "determine"
   */
  interactiveType?: "date" | "determine";
  /**
   * 选择器文本样式
   * @default selectortextStyle = { "fontFamily": "Microsoft Yahei", "fontSize": 16, "color": "#ffffff", "fontWeight": "normal", "letterSpacing": 0, "fontStyle": "normal"}
   */
  selectortextStyle?: style;
  /**
   * 选择器文本缩进
   * @default textIndent = 10
   */
  textIndent?: number;
  /**
   * 选择器文本背景色: 开始色值 | 结束色值 | 角度
   * @default fillColor = {"startVal": "#0A1015","endVal": "#0A1015","direction": 0}
   */
  selectorbackgroundColor?: fillColor;
  /**
   * 边框
   * @default frame = true
   */
  frame?: boolean;
  /**
   * 边框粗细 当frame = true 是生效
   * @default thickness = 1
   */
  thickness?: number;
  /**
   * 边框默认颜色 当frame = true 是生效
   * @default defaultColor = "#CCCCCC"
   */
  defaultColor?: string;
  /**
   * 边框激活颜色 当frame = true 是生效
   * @default activationColor = "#EEEEEE"
   */
  activationColor?: string;
  /**
   * 日历布局
   * @type {string}
   * @default layoutType = "down"
   */
  layoutType?: "up" | "down";
  /**
   * 日历间距
   * @default spacing = 5
   */
  spacing?: number;
  /**
   * 日历位置类型
   * @default locationType = "left"
   */
  locationType?: "left" | "auto" | "right";
  /**
   * 日历框尺寸 当locationType = "left" | "right" 时生效; 单位px
   * @default frameSize = {"w": 300,"h": 300}
   */
  frameSize?: {
    w: number;
    h: number;
  };
  /**
   * 日历背景色
   * @default backgroundColor = "#091015"
   */
  backgroundColor?: string;
  /**
   * 日历主题色块
   * @default themeColor = "#4281F7"
   */
  themeColor?: string;
  /**
   * 日历文本样式
   * @default calendartextStyle = {"fontFamily": "Microsoft Yahei","fontSize": 16,"color": "#ffffff","fontWeight": "normal","letterSpacing": 0,"lineHeight": 0,"fontStyle": "normal"}
   */
  calendartextStyle?: style;
  /**
   * 日历装饰线
   * @default decorativeLine = "#323538"
   */
  decorativeLine?: string;
  /**
   * 日历按钮文本样式
   * @default calendartextStyle = {"fontFamily": "Microsoft Yahei","fontSize": 16,"color": "#ffffff","fontWeight": "normal","letterSpacing": 0,"lineHeight": 0,"fontStyle": "normal"}
   */
  buttonStyle?: style;
  /**
   * 数据
   */
  data?: dataProps;
  /**
   * 点击回调
   */
  readonly onClick?: (e: any) => void;
}
```

---
_Source: https://npm.io/package/@xintao1105/date-time-picker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
