File tree Expand file tree Collapse file tree 4 files changed +63
-61
lines changed
Expand file tree Collapse file tree 4 files changed +63
-61
lines changed Original file line number Diff line number Diff line change 4040 "react" : " ^17.0.2 || ^18.2.0"
4141 },
4242 "devDependencies" : {
43- "@rollup/plugin-commonjs" : " ^22 .0.1" ,
44- "@rollup/plugin-node-resolve" : " ^13.3.0 " ,
45- "@rollup/plugin-typescript" : " ^9 .0.2 " ,
43+ "@rollup/plugin-commonjs" : " ^24 .0.1" ,
44+ "@rollup/plugin-node-resolve" : " ^15.0.1 " ,
45+ "@rollup/plugin-typescript" : " ^11 .0.0 " ,
4646 "@tailwindcss/forms" : " ^0.5.3" ,
47+ "@types/node" : " 18.14.5" ,
4748 "@types/react" : " ^18.0.21" ,
4849 "@typescript-eslint/eslint-plugin" : " ^5.45.0" ,
4950 "@typescript-eslint/parser" : " ^5.45.0" ,
Original file line number Diff line number Diff line change 11import dayjs from "dayjs" ;
22import React , { useCallback , useContext , useMemo } from "react" ;
33
4- import { DEFAULT_SHORTCUTS , TEXT_COLOR } from "../constants" ;
4+ import { TEXT_COLOR } from "../constants" ;
5+ import DEFAULT_SHORTCUTS from "../constants/shortcuts" ;
56import DatepickerContext from "../contexts/DatepickerContext" ;
67import { Period , ShortcutsItem } from "../types" ;
78
Original file line number Diff line number Diff line change 1- import dayjs from "dayjs" ;
2-
3- import { formatDate , previousMonth } from "../helpers" ;
4-
5- import { ShortcutsItem } from "types" ;
6-
71export const COLORS = [
82 "blue" ,
93 "orange" ,
@@ -283,54 +277,3 @@ export const BUTTON_COLOR = {
283277 rose : "focus:ring-rose-500/50 focus:bg-rose-100/50"
284278 }
285279} ;
286-
287- export const DEFAULT_SHORTCUTS : {
288- [ key in string ] : ShortcutsItem | ShortcutsItem [ ] ;
289- } = {
290- today : {
291- text : "Today" ,
292- period : {
293- start : formatDate ( dayjs ( ) ) ,
294- end : formatDate ( dayjs ( ) )
295- }
296- } ,
297- yesterday : {
298- text : "Yesterday" ,
299- period : {
300- start : formatDate ( dayjs ( ) . subtract ( 1 , "d" ) ) ,
301- end : formatDate ( dayjs ( ) . subtract ( 1 , "d" ) )
302- }
303- } ,
304- past : [
305- {
306- daysNumber : 7 ,
307- text : "Last 7 days" ,
308- period : {
309- start : formatDate ( dayjs ( ) . subtract ( 7 , "d" ) ) ,
310- end : formatDate ( dayjs ( ) )
311- }
312- } ,
313- {
314- daysNumber : 30 ,
315- text : "Last 30 days" ,
316- period : {
317- start : formatDate ( dayjs ( ) . subtract ( 30 , "d" ) ) ,
318- end : formatDate ( dayjs ( ) )
319- }
320- }
321- ] ,
322- currentMonth : {
323- text : "This month" ,
324- period : {
325- start : formatDate ( dayjs ( ) . startOf ( "month" ) ) ,
326- end : formatDate ( dayjs ( ) . endOf ( "month" ) )
327- }
328- } ,
329- pastMonth : {
330- text : "Last month" ,
331- period : {
332- start : formatDate ( previousMonth ( dayjs ( ) ) . startOf ( "month" ) ) ,
333- end : formatDate ( previousMonth ( dayjs ( ) ) . endOf ( "month" ) )
334- }
335- }
336- } ;
Original file line number Diff line number Diff line change 1+ import dayjs from "dayjs" ;
2+
3+ import { formatDate , previousMonth } from "../helpers" ;
4+ import { ShortcutsItem } from "../types" ;
5+
6+ const DEFAULT_SHORTCUTS : {
7+ [ key in string ] : ShortcutsItem | ShortcutsItem [ ] ;
8+ } = {
9+ today : {
10+ text : "Today" ,
11+ period : {
12+ start : formatDate ( dayjs ( ) ) ,
13+ end : formatDate ( dayjs ( ) )
14+ }
15+ } ,
16+ yesterday : {
17+ text : "Yesterday" ,
18+ period : {
19+ start : formatDate ( dayjs ( ) . subtract ( 1 , "d" ) ) ,
20+ end : formatDate ( dayjs ( ) . subtract ( 1 , "d" ) )
21+ }
22+ } ,
23+ past : [
24+ {
25+ daysNumber : 7 ,
26+ text : "Last 7 days" ,
27+ period : {
28+ start : formatDate ( dayjs ( ) . subtract ( 7 , "d" ) ) ,
29+ end : formatDate ( dayjs ( ) )
30+ }
31+ } ,
32+ {
33+ daysNumber : 30 ,
34+ text : "Last 30 days" ,
35+ period : {
36+ start : formatDate ( dayjs ( ) . subtract ( 30 , "d" ) ) ,
37+ end : formatDate ( dayjs ( ) )
38+ }
39+ }
40+ ] ,
41+ currentMonth : {
42+ text : "This month" ,
43+ period : {
44+ start : formatDate ( dayjs ( ) . startOf ( "month" ) ) ,
45+ end : formatDate ( dayjs ( ) . endOf ( "month" ) )
46+ }
47+ } ,
48+ pastMonth : {
49+ text : "Last month" ,
50+ period : {
51+ start : formatDate ( previousMonth ( dayjs ( ) ) . startOf ( "month" ) ) ,
52+ end : formatDate ( previousMonth ( dayjs ( ) ) . endOf ( "month" ) )
53+ }
54+ }
55+ } ;
56+
57+ export default DEFAULT_SHORTCUTS ;
You can’t perform that action at this time.
0 commit comments