0.0.7 • Published 2 years ago

@ant-extensions/super-date v0.0.7

Weekly downloads
76
License
MIT
Repository
github
Last release
2 years ago

Ant Extensions - Date Selector

Date Selector for relative dates with DateMath


Install

# Using npm
npm install @ant-extensions/super-date

# Using yarn
yarn add @ant-extensions/super-date

Basic Usage

  • RelativeRangePicker
import React, { useState } from "react";
import { Form } from "antd";
import { ReactDateSelector } from "@ant-extensions/super-date";

export const Tester = () => {
  const [date, setDate] = useState<string | undefined>("$week|$now");

  return (
    <Form layout="inline">
      <Form.Item label="Date Selector">
        <ReactDateSelector value={date} onDateChange={setDate} allowClear />
      </Form.Item>
    </Form>
  );
};

Component uses basic ant.design InputProps

Props

  • value: string
  • onDateChange: (date: string) => void
  • open: boolean
  • onVisibleChange: (open: boolean) => void

  • Util to parse date values and labels
import { DateUtils } from "@ant-extensions/super-date";

// Last 7 Days
DateUtils.label("$day-7");

// Last 7 Days ~ Now
DateUtils.label("$day-7|$now");

/**
 * @return [iso_date, iso_date]
 * Return string array of [start, end]
 */
DateUtils.parse("$day-7|$now");

/**
 * @return iso_date
 * Return single date string
 */
DateUtils.parse("$day-7");
0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago