Basic.tsx 2.31 KB
Newer Older
涂茜's avatar
涂茜 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
import React from 'react';
import { getTimeRange, getRange } from '../index';

const Demo = () => {
  return (
    <div>
      <h2>getTimeRange(type):</h2>
      <div>
        <b>全部:</b> {JSON.stringify(getTimeRange())}
      </div>
      <div>
        <b>今年-thisYear:</b> {JSON.stringify(getTimeRange('thisYear'))}
      </div>
      <div>
        <b>去年-lastYear:</b> {JSON.stringify(getTimeRange('lastYear'))}
      </div>
      <div>
        <b>明年-nextYear:</b> {JSON.stringify(getTimeRange('nextYear'))}
      </div>
      <div>
        <b>上季度-lastQuarter:</b> {JSON.stringify(getTimeRange('lastQuarter'))}
      </div>
      <div>
        <b>本季度-thisQuarter:</b> {JSON.stringify(getTimeRange('thisQuarter'))}
      </div>
      <div>
        <b>下季度-nextQuarter:</b> {JSON.stringify(getTimeRange('nextQuarter'))}
      </div>
      <div>
        <b>上月-lastMonth:</b> {JSON.stringify(getTimeRange('lastMonth'))}
      </div>
      <div>
        <b>本月-thisMonth:</b> {JSON.stringify(getTimeRange('thisMonth'))}
      </div>
      <div>
        <b>下月-nextMonth:</b> {JSON.stringify(getTimeRange('nextMonth'))}
      </div>
      <div>
        <b>上周-lastWeek:</b> {JSON.stringify(getTimeRange('lastWeek'))}
      </div>
      <div>
        <b>本周-thisWeek:</b> {JSON.stringify(getTimeRange('thisWeek'))}
      </div>
      <div>
        <b>下周-nextWeek:</b> {JSON.stringify(getTimeRange('nextWeek'))}
      </div>
      <div>
        <b>昨天-lastDay:</b> {JSON.stringify(getTimeRange('lastDay'))}
      </div>
      <div>
        <b>今天-thisDay:</b> {JSON.stringify(getTimeRange('thisDay'))}
      </div>
      <div>
        <b>明天-nextDay:</b> {JSON.stringify(getTimeRange('nextDay'))}
      </div>
      <br />
      <h2>getRange(date, type):</h2>
      <div>
        <b>type:</b> {JSON.stringify(getRange())}
      </div>
      <div>
        <b>type-day:</b> {JSON.stringify(getRange(new Date(), 'day'))}
      </div>
      <div>
        <b>type-week:</b> {JSON.stringify(getRange(new Date(), 'week'))}
      </div>
      <div>
        <b>type-month:</b> {JSON.stringify(getRange(new Date(), 'month'))}
      </div>
      <div>
        <b>type-year:</b> {JSON.stringify(getRange(new Date(), 'year'))}
      </div>
    </div>
  );
};

export default Demo;