How to use date method in fast-check-monorepo

Best JavaScript code snippet using fast-check-monorepo

irregular-data-series.js

Source:irregular-data-series.js Github

copy

Full Screen

1var dataSeries = [2 [{3 "date": "2014-01-01",4 "value": 200000005 },6 {7 "date": "2014-01-02",8 "value": 103799789 },10 {11 "date": "2014-01-03",12 "value": 3049374913 },14 {15 "date": "2014-01-04",16 "value": 1078525017 },18 {19 "date": "2014-01-05",20 "value": 3390190421 },22 {23 "date": "2014-01-06",24 "value": 1157683825 },26 {27 "date": "2014-01-07",28 "value": 1441385429 },30 {31 "date": "2014-01-08",32 "value": 1517721133 },34 {35 "date": "2014-01-09",36 "value": 1662210037 },38 {39 "date": "2014-01-10",40 "value": 1738107241 },42 {43 "date": "2014-01-11",44 "value": 1880231045 },46 {47 "date": "2014-01-12",48 "value": 1553179049 },50 {51 "date": "2014-01-13",52 "value": 1574888153 },54 {55 "date": "2014-01-14",56 "value": 1870643757 },58 {59 "date": "2014-01-15",60 "value": 1975268561 },62 {63 "date": "2014-01-16",64 "value": 2101641865 },66 {67 "date": "2014-01-17",68 "value": 2562292469 },70 {71 "date": "2014-01-18",72 "value": 2533748073 },74 {75 "date": "2014-01-19",76 "value": 2225888277 },78 {79 "date": "2014-01-20",80 "value": 2382953881 },82 {83 "date": "2014-01-21",84 "value": 2424568985 },86 {87 "date": "2014-01-22",88 "value": 2642971189 },90 {91 "date": "2014-01-23",92 "value": 2625901793 },94 {95 "date": "2014-01-24",96 "value": 2539618397 },98 {99 "date": "2014-01-25",100 "value": 23107346101 },102 {103 "date": "2014-01-26",104 "value": 28659852105 },106 {107 "date": "2014-01-27",108 "value": 25270783109 },110 {111 "date": "2014-01-28",112 "value": 26270783113 },114 {115 "date": "2014-01-29",116 "value": 27270783117 },118 {119 "date": "2014-01-30",120 "value": 28270783121 },122 {123 "date": "2014-01-31",124 "value": 29270783125 },126 {127 "date": "2014-02-01",128 "value": 30270783129 },130 {131 "date": "2014-02-02",132 "value": 31270783133 },134 {135 "date": "2014-02-03",136 "value": 32270783137 },138 {139 "date": "2014-02-04",140 "value": 33270783141 },142 {143 "date": "2014-02-05",144 "value": 28270783145 },146 {147 "date": "2014-02-06",148 "value": 27270783149 },150 {151 "date": "2014-02-07",152 "value": 35270783153 },154 {155 "date": "2014-02-08",156 "value": 34270783157 },158 {159 "date": "2014-02-09",160 "value": 28270783161 },162 {163 "date": "2014-02-10",164 "value": 35270783165 },166 {167 "date": "2014-02-11",168 "value": 36270783169 },170 {171 "date": "2014-02-12",172 "value": 34127078173 },174 {175 "date": "2014-02-13",176 "value": 33124078177 },178 {179 "date": "2014-02-14",180 "value": 36227078181 },182 {183 "date": "2014-02-15",184 "value": 37827078185 },186 {187 "date": "2014-02-16",188 "value": 36427073189 },190 {191 "date": "2014-02-17",192 "value": 37570783193 },194 {195 "date": "2014-02-18",196 "value": 38627073197 },198 {199 "date": "2014-02-19",200 "value": 37727078201 },202 {203 "date": "2014-02-20",204 "value": 38827073205 },206 {207 "date": "2014-02-21",208 "value": 40927078209 },210 {211 "date": "2014-02-22",212 "value": 41027078213 },214 {215 "date": "2014-02-23",216 "value": 42127073217 },218 {219 "date": "2014-02-24",220 "value": 43220783221 },222 {223 "date": "2014-02-25",224 "value": 44327078225 },226 {227 "date": "2014-02-26",228 "value": 40427078229 },230 {231 "date": "2014-02-27",232 "value": 41027078233 },234 {235 "date": "2014-02-28",236 "value": 45627078237 },238 {239 "date": "2014-03-01",240 "value": 44727078241 },242 {243 "date": "2014-03-02",244 "value": 44227078245 },246 {247 "date": "2014-03-03",248 "value": 45227078249 },250 {251 "date": "2014-03-04",252 "value": 46027078253 },254 {255 "date": "2014-03-05",256 "value": 46927078257 },258 {259 "date": "2014-03-06",260 "value": 47027078261 },262 {263 "date": "2014-03-07",264 "value": 46227078265 },266 {267 "date": "2014-03-08",268 "value": 47027078269 },270 {271 "date": "2014-03-09",272 "value": 48027078273 },274 {275 "date": "2014-03-10",276 "value": 47027078277 },278 {279 "date": "2014-03-11",280 "value": 47027078281 },282 {283 "date": "2014-03-12",284 "value": 48017078285 },286 {287 "date": "2014-03-13",288 "value": 48077078289 },290 {291 "date": "2014-03-14",292 "value": 48087078293 },294 {295 "date": "2014-03-15",296 "value": 48017078297 },298 {299 "date": "2014-03-16",300 "value": 48047078301 },302 {303 "date": "2014-03-17",304 "value": 48067078305 },306 {307 "date": "2014-03-18",308 "value": 48077078309 },310 {311 "date": "2014-03-19",312 "value": 48027074313 },314 {315 "date": "2014-03-20",316 "value": 48927079317 },318 {319 "date": "2014-03-21",320 "value": 48727071321 },322 {323 "date": "2014-03-22",324 "value": 48127072325 },326 {327 "date": "2014-03-23",328 "value": 48527072329 },330 {331 "date": "2014-03-24",332 "value": 48627027333 },334 {335 "date": "2014-03-25",336 "value": 48027040337 },338 {339 "date": "2014-03-26",340 "value": 48027043341 },342 {343 "date": "2014-03-27",344 "value": 48057022345 },346 {347 "date": "2014-03-28",348 "value": 49057022349 },350 {351 "date": "2014-03-29",352 "value": 50057022353 },354 {355 "date": "2014-03-30",356 "value": 51057022357 },358 {359 "date": "2014-03-31",360 "value": 52057022361 },362 {363 "date": "2014-04-01",364 "value": 53057022365 },366 {367 "date": "2014-04-02",368 "value": 54057022369 },370 {371 "date": "2014-04-03",372 "value": 52057022373 },374 {375 "date": "2014-04-04",376 "value": 55057022377 },378 {379 "date": "2014-04-05",380 "value": 58270783381 },382 {383 "date": "2014-04-06",384 "value": 56270783385 },386 {387 "date": "2014-04-07",388 "value": 55270783389 },390 {391 "date": "2014-04-08",392 "value": 58270783393 },394 {395 "date": "2014-04-09",396 "value": 59270783397 },398 {399 "date": "2014-04-10",400 "value": 60270783401 },402 {403 "date": "2014-04-11",404 "value": 61270783405 },406 {407 "date": "2014-04-12",408 "value": 62270783409 },410 {411 "date": "2014-04-13",412 "value": 63270783413 },414 {415 "date": "2014-04-14",416 "value": 64270783417 },418 {419 "date": "2014-04-15",420 "value": 65270783421 },422 {423 "date": "2014-04-16",424 "value": 66270783425 },426 {427 "date": "2014-04-17",428 "value": 67270783429 },430 {431 "date": "2014-04-18",432 "value": 68270783433 },434 {435 "date": "2014-04-19",436 "value": 69270783437 },438 {439 "date": "2014-04-20",440 "value": 70270783441 },442 {443 "date": "2014-04-21",444 "value": 71270783445 },446 {447 "date": "2014-04-22",448 "value": 72270783449 },450 {451 "date": "2014-04-23",452 "value": 73270783453 },454 {455 "date": "2014-04-24",456 "value": 74270783457 },458 {459 "date": "2014-04-25",460 "value": 75270783461 },462 {463 "date": "2014-04-26",464 "value": 76660783465 },466 {467 "date": "2014-04-27",468 "value": 77270783469 },470 {471 "date": "2014-04-28",472 "value": 78370783473 },474 {475 "date": "2014-04-29",476 "value": 79470783477 },478 {479 "date": "2014-04-30",480 "value": 80170783481 }482 ],483 [{484 "date": "2014-01-01",485 "value": 150000000486 },487 {488 "date": "2014-01-02",489 "value": 160379978490 },491 {492 "date": "2014-01-03",493 "value": 170493749494 },495 {496 "date": "2014-01-04",497 "value": 160785250498 },499 {500 "date": "2014-01-05",501 "value": 167391904502 },503 {504 "date": "2014-01-06",505 "value": 161576838506 },507 {508 "date": "2014-01-07",509 "value": 161413854510 },511 {512 "date": "2014-01-08",513 "value": 152177211514 },515 {516 "date": "2014-01-09",517 "value": 140762210518 },519 {520 "date": "2014-01-10",521 "value": 144381072522 },523 {524 "date": "2014-01-11",525 "value": 154352310526 },527 {528 "date": "2014-01-12",529 "value": 165531790530 },531 {532 "date": "2014-01-13",533 "value": 175748881534 },535 {536 "date": "2014-01-14",537 "value": 187064037538 },539 {540 "date": "2014-01-15",541 "value": 197520685542 },543 {544 "date": "2014-01-16",545 "value": 210176418546 },547 {548 "date": "2014-01-17",549 "value": 196122924550 },551 {552 "date": "2014-01-18",553 "value": 207337480554 },555 {556 "date": "2014-01-19",557 "value": 200258882558 },559 {560 "date": "2014-01-20",561 "value": 186829538562 },563 {564 "date": "2014-01-21",565 "value": 192456897566 },567 {568 "date": "2014-01-22",569 "value": 204299711570 },571 {572 "date": "2014-01-23",573 "value": 192759017574 },575 {576 "date": "2014-01-24",577 "value": 203596183578 },579 {580 "date": "2014-01-25",581 "value": 208107346582 },583 {584 "date": "2014-01-26",585 "value": 196359852586 },587 {588 "date": "2014-01-27",589 "value": 192570783590 },591 {592 "date": "2014-01-28",593 "value": 177967768594 },595 {596 "date": "2014-01-29",597 "value": 190632803598 },599 {600 "date": "2014-01-30",601 "value": 203725316602 },603 {604 "date": "2014-01-31",605 "value": 218226177606 },607 {608 "date": "2014-02-01",609 "value": 210698669610 },611 {612 "date": "2014-02-02",613 "value": 217640656614 },615 {616 "date": "2014-02-03",617 "value": 216142362618 },619 {620 "date": "2014-02-04",621 "value": 201410971622 },623 {624 "date": "2014-02-05",625 "value": 196704289626 },627 {628 "date": "2014-02-06",629 "value": 190436945630 },631 {632 "date": "2014-02-07",633 "value": 178891686634 },635 {636 "date": "2014-02-08",637 "value": 171613962638 },639 {640 "date": "2014-02-09",641 "value": 157579773642 },643 {644 "date": "2014-02-10",645 "value": 158677098646 },647 {648 "date": "2014-02-11",649 "value": 147129977650 },651 {652 "date": "2014-02-12",653 "value": 151561876654 },655 {656 "date": "2014-02-13",657 "value": 151627421658 },659 {660 "date": "2014-02-14",661 "value": 143543872662 },663 {664 "date": "2014-02-15",665 "value": 136581057666 },667 {668 "date": "2014-02-16",669 "value": 135560715670 },671 {672 "date": "2014-02-17",673 "value": 122625263674 },675 {676 "date": "2014-02-18",677 "value": 112091484678 },679 {680 "date": "2014-02-19",681 "value": 98810329682 },683 {684 "date": "2014-02-20",685 "value": 99882912686 },687 {688 "date": "2014-02-21",689 "value": 94943095690 },691 {692 "date": "2014-02-22",693 "value": 104875743694 },695 {696 "date": "2014-02-23",697 "value": 116383678698 },699 {700 "date": "2014-02-24",701 "value": 125028841702 },703 {704 "date": "2014-02-25",705 "value": 123967310706 },707 {708 "date": "2014-02-26",709 "value": 133167029710 },711 {712 "date": "2014-02-27",713 "value": 128577263714 },715 {716 "date": "2014-02-28",717 "value": 115836969718 },719 {720 "date": "2014-03-01",721 "value": 119264529722 },723 {724 "date": "2014-03-02",725 "value": 109363374726 },727 {728 "date": "2014-03-03",729 "value": 113985628730 },731 {732 "date": "2014-03-04",733 "value": 114650999734 },735 {736 "date": "2014-03-05",737 "value": 110866108738 },739 {740 "date": "2014-03-06",741 "value": 96473454742 },743 {744 "date": "2014-03-07",745 "value": 104075886746 },747 {748 "date": "2014-03-08",749 "value": 103568384750 },751 {752 "date": "2014-03-09",753 "value": 101534883754 },755 {756 "date": "2014-03-10",757 "value": 115825447758 },759 {760 "date": "2014-03-11",761 "value": 126133916762 },763 {764 "date": "2014-03-12",765 "value": 116502109766 },767 {768 "date": "2014-03-13",769 "value": 130169411770 },771 {772 "date": "2014-03-14",773 "value": 124296886774 },775 {776 "date": "2014-03-15",777 "value": 126347399778 },779 {780 "date": "2014-03-16",781 "value": 131483669782 },783 {784 "date": "2014-03-17",785 "value": 142811333786 },787 {788 "date": "2014-03-18",789 "value": 129675396790 },791 {792 "date": "2014-03-19",793 "value": 115514483794 },795 {796 "date": "2014-03-20",797 "value": 117630630798 },799 {800 "date": "2014-03-21",801 "value": 122340239802 },803 {804 "date": "2014-03-22",805 "value": 132349091806 },807 {808 "date": "2014-03-23",809 "value": 125613305810 },811 {812 "date": "2014-03-24",813 "value": 135592466814 },815 {816 "date": "2014-03-25",817 "value": 123408762818 },819 {820 "date": "2014-03-26",821 "value": 111991454822 },823 {824 "date": "2014-03-27",825 "value": 116123955826 },827 {828 "date": "2014-03-28",829 "value": 112817214830 },831 {832 "date": "2014-03-29",833 "value": 113029590834 },835 {836 "date": "2014-03-30",837 "value": 108753398838 },839 {840 "date": "2014-03-31",841 "value": 99383763842 },843 {844 "date": "2014-04-01",845 "value": 100151737846 },847 {848 "date": "2014-04-02",849 "value": 94985209850 },851 {852 "date": "2014-04-03",853 "value": 82913669854 },855 {856 "date": "2014-04-04",857 "value": 78748268858 },859 {860 "date": "2014-04-05",861 "value": 63829135862 },863 {864 "date": "2014-04-06",865 "value": 78694727866 },867 {868 "date": "2014-04-07",869 "value": 80868994870 },871 {872 "date": "2014-04-08",873 "value": 93799013874 },875 {876 "date": "2014-04-09",877 "value": 99042416878 },879 {880 "date": "2014-04-10",881 "value": 97298692882 },883 {884 "date": "2014-04-11",885 "value": 83353499886 },887 {888 "date": "2014-04-12",889 "value": 71248129890 },891 {892 "date": "2014-04-13",893 "value": 75253744894 },895 {896 "date": "2014-04-14",897 "value": 68976648898 },899 {900 "date": "2014-04-15",901 "value": 71002284902 },903 {904 "date": "2014-04-16",905 "value": 75052401906 },907 {908 "date": "2014-04-17",909 "value": 83894030910 },911 {912 "date": "2014-04-18",913 "value": 90236528914 },915 {916 "date": "2014-04-19",917 "value": 99739114918 },919 {920 "date": "2014-04-20",921 "value": 96407136922 },923 {924 "date": "2014-04-21",925 "value": 108323177926 },927 {928 "date": "2014-04-22",929 "value": 101578914930 },931 {932 "date": "2014-04-23",933 "value": 115877608934 },935 {936 "date": "2014-04-24",937 "value": 112088857938 },939 {940 "date": "2014-04-25",941 "value": 112071353942 },943 {944 "date": "2014-04-26",945 "value": 101790062946 },947 {948 "date": "2014-04-27",949 "value": 115003761950 },951 {952 "date": "2014-04-28",953 "value": 120457727954 },955 {956 "date": "2014-04-29",957 "value": 118253926958 },959 {960 "date": "2014-04-30",961 "value": 117956992962 }963 ],964 [{965 "date": "2014-01-01",966 "value": 50000000967 },968 {969 "date": "2014-01-02",970 "value": 60379978971 },972 {973 "date": "2014-01-03",974 "value": 40493749975 },976 {977 "date": "2014-01-04",978 "value": 60785250979 },980 {981 "date": "2014-01-05",982 "value": 67391904983 },984 {985 "date": "2014-01-06",986 "value": 61576838987 },988 {989 "date": "2014-01-07",990 "value": 61413854991 },992 {993 "date": "2014-01-08",994 "value": 82177211995 },996 {997 "date": "2014-01-09",998 "value": 103762210999 },1000 {1001 "date": "2014-01-10",1002 "value": 843810721003 },1004 {1005 "date": "2014-01-11",1006 "value": 543523101007 },1008 {1009 "date": "2014-01-12",1010 "value": 655317901011 },1012 {1013 "date": "2014-01-13",1014 "value": 757488811015 },1016 {1017 "date": "2014-01-14",1018 "value": 470640371019 },1020 {1021 "date": "2014-01-15",1022 "value": 675206851023 },1024 {1025 "date": "2014-01-16",1026 "value": 601764181027 },1028 {1029 "date": "2014-01-17",1030 "value": 661229241031 },1032 {1033 "date": "2014-01-18",1034 "value": 573374801035 },1036 {1037 "date": "2014-01-19",1038 "value": 1002588821039 },1040 {1041 "date": "2014-01-20",1042 "value": 468295381043 },1044 {1045 "date": "2014-01-21",1046 "value": 924568971047 },1048 {1049 "date": "2014-01-22",1050 "value": 942997111051 },1052 {1053 "date": "2014-01-23",1054 "value": 627590171055 },1056 {1057 "date": "2014-01-24",1058 "value": 1035961831059 },1060 {1061 "date": "2014-01-25",1062 "value": 1081073461063 },1064 {1065 "date": "2014-01-26",1066 "value": 663598521067 },1068 {1069 "date": "2014-01-27",1070 "value": 625707831071 },1072 {1073 "date": "2014-01-28",1074 "value": 779677681075 },1076 {1077 "date": "2014-01-29",1078 "value": 606328031079 },1080 {1081 "date": "2014-01-30",1082 "value": 1037253161083 },1084 {1085 "date": "2014-01-31",1086 "value": 982261771087 },1088 {1089 "date": "2014-02-01",1090 "value": 606986691091 },1092 {1093 "date": "2014-02-02",1094 "value": 676406561095 },1096 {1097 "date": "2014-02-03",1098 "value": 661423621099 },1100 {1101 "date": "2014-02-04",1102 "value": 1014109711103 },1104 {1105 "date": "2014-02-05",1106 "value": 667042891107 },1108 {1109 "date": "2014-02-06",1110 "value": 604369451111 },1112 {1113 "date": "2014-02-07",1114 "value": 788916861115 },1116 {1117 "date": "2014-02-08",1118 "value": 716139621119 },1120 {1121 "date": "2014-02-09",1122 "value": 1075797731123 },1124 {1125 "date": "2014-02-10",1126 "value": 586770981127 },1128 {1129 "date": "2014-02-11",1130 "value": 871299771131 },1132 {1133 "date": "2014-02-12",1134 "value": 515618761135 },1136 {1137 "date": "2014-02-13",1138 "value": 516274211139 },1140 {1141 "date": "2014-02-14",1142 "value": 835438721143 },1144 {1145 "date": "2014-02-15",1146 "value": 665810571147 },1148 {1149 "date": "2014-02-16",1150 "value": 655607151151 },1152 {1153 "date": "2014-02-17",1154 "value": 626252631155 },1156 {1157 "date": "2014-02-18",1158 "value": 920914841159 },1160 {1161 "date": "2014-02-19",1162 "value": 488103291163 },1164 {1165 "date": "2014-02-20",1166 "value": 498829121167 },1168 {1169 "date": "2014-02-21",1170 "value": 449430951171 },1172 {1173 "date": "2014-02-22",1174 "value": 1048757431175 },1176 {1177 "date": "2014-02-23",1178 "value": 963836781179 },1180 {1181 "date": "2014-02-24",1182 "value": 1050288411183 },1184 {1185 "date": "2014-02-25",1186 "value": 639673101187 },1188 {1189 "date": "2014-02-26",1190 "value": 631670291191 },1192 {1193 "date": "2014-02-27",1194 "value": 685772631195 },1196 {1197 "date": "2014-02-28",1198 "value": 958369691199 },1200 {1201 "date": "2014-03-01",1202 "value": 992645291203 },1204 {1205 "date": "2014-03-02",1206 "value": 1093633741207 },1208 {1209 "date": "2014-03-03",1210 "value": 939856281211 },1212 {1213 "date": "2014-03-04",1214 "value": 946509991215 },1216 {1217 "date": "2014-03-05",1218 "value": 908661081219 },1220 {1221 "date": "2014-03-06",1222 "value": 464734541223 },1224 {1225 "date": "2014-03-07",1226 "value": 840758861227 },1228 {1229 "date": "2014-03-08",1230 "value": 1035683841231 },1232 {1233 "date": "2014-03-09",1234 "value": 1015348831235 },1236 {1237 "date": "2014-03-10",1238 "value": 958254471239 },1240 {1241 "date": "2014-03-11",1242 "value": 661339161243 },1244 {1245 "date": "2014-03-12",1246 "value": 965021091247 },1248 {1249 "date": "2014-03-13",1250 "value": 801694111251 },1252 {1253 "date": "2014-03-14",1254 "value": 842968861255 },1256 {1257 "date": "2014-03-15",1258 "value": 863473991259 },1260 {1261 "date": "2014-03-16",1262 "value": 314836691263 },1264 {1265 "date": "2014-03-17",1266 "value": 828113331267 },1268 {1269 "date": "2014-03-18",1270 "value": 896753961271 },1272 {1273 "date": "2014-03-19",1274 "value": 955144831275 },1276 {1277 "date": "2014-03-20",1278 "value": 976306301279 },1280 {1281 "date": "2014-03-21",1282 "value": 623402391283 },1284 {1285 "date": "2014-03-22",1286 "value": 623490911287 },1288 {1289 "date": "2014-03-23",1290 "value": 656133051291 },1292 {1293 "date": "2014-03-24",1294 "value": 655924661295 },1296 {1297 "date": "2014-03-25",1298 "value": 634087621299 },1300 {1301 "date": "2014-03-26",1302 "value": 919914541303 },1304 {1305 "date": "2014-03-27",1306 "value": 961239551307 },1308 {1309 "date": "2014-03-28",1310 "value": 928172141311 },1312 {1313 "date": "2014-03-29",1314 "value": 930295901315 },1316 {1317 "date": "2014-03-30",1318 "value": 1087533981319 },1320 {1321 "date": "2014-03-31",1322 "value": 493837631323 },1324 {1325 "date": "2014-04-01",1326 "value": 1001517371327 },1328 {1329 "date": "2014-04-02",1330 "value": 449852091331 },1332 {1333 "date": "2014-04-03",1334 "value": 529136691335 },1336 {1337 "date": "2014-04-04",1338 "value": 487482681339 },1340 {1341 "date": "2014-04-05",1342 "value": 238291351343 },1344 {1345 "date": "2014-04-06",1346 "value": 586947271347 },1348 {1349 "date": "2014-04-07",1350 "value": 508689941351 },1352 {1353 "date": "2014-04-08",1354 "value": 437990131355 },1356 {1357 "date": "2014-04-09",1358 "value": 40424161359 },1360 {1361 "date": "2014-04-10",1362 "value": 472986921363 },1364 {1365 "date": "2014-04-11",1366 "value": 533534991367 },1368 {1369 "date": "2014-04-12",1370 "value": 712481291371 },1372 {1373 "date": "2014-04-13",1374 "value": 752537441375 },1376 {1377 "date": "2014-04-14",1378 "value": 689766481379 },1380 {1381 "date": "2014-04-15",1382 "value": 710022841383 },1384 {1385 "date": "2014-04-16",1386 "value": 750524011387 },1388 {1389 "date": "2014-04-17",1390 "value": 838940301391 },1392 {1393 "date": "2014-04-18",1394 "value": 502365281395 },1396 {1397 "date": "2014-04-19",1398 "value": 597391141399 },1400 {1401 "date": "2014-04-20",1402 "value": 564071361403 },1404 {1405 "date": "2014-04-21",1406 "value": 1083231771407 },1408 {1409 "date": "2014-04-22",1410 "value": 1015789141411 },1412 {1413 "date": "2014-04-23",1414 "value": 958776081415 },1416 {1417 "date": "2014-04-24",1418 "value": 620888571419 },1420 {1421 "date": "2014-04-25",1422 "value": 920713531423 },1424 {1425 "date": "2014-04-26",1426 "value": 817900621427 },1428 {1429 "date": "2014-04-27",1430 "value": 1050037611431 },1432 {1433 "date": "2014-04-28",1434 "value": 1004577271435 },1436 {1437 "date": "2014-04-29",1438 "value": 982539261439 },1440 {1441 "date": "2014-04-30",1442 "value": 679569921443 }1444 ]...

Full Screen

Full Screen

daterange.js

Source:daterange.js Github

copy

Full Screen

1// Copyright 2008 The Closure Library Authors. All Rights Reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS-IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14/**15 * @fileoverview Date range data structure. Based loosely on16 * com.google.common.util.DateRange.17 *18 * @author dpb@google.com (David P. Baker)19 */20goog.provide('goog.date.DateRange');21goog.provide('goog.date.DateRange.Iterator');22goog.provide('goog.date.DateRange.StandardDateRangeKeys');23goog.require('goog.date.Date');24goog.require('goog.date.Interval');25goog.require('goog.iter.Iterator');26goog.require('goog.iter.StopIteration');27/**28 * Constructs a date range.29 * @constructor30 * @struct31 * @param {goog.date.Date} startDate The first date in the range.32 * @param {goog.date.Date} endDate The last date in the range.33 * @final34 */35goog.date.DateRange = function(startDate, endDate) {36 /**37 * The first date in the range.38 * @type {goog.date.Date}39 * @private40 */41 this.startDate_ = startDate;42 /**43 * The last date in the range.44 * @type {goog.date.Date}45 * @private46 */47 this.endDate_ = endDate;48};49/**50 * The first possible day, as far as this class is concerned.51 * @type {goog.date.Date}52 */53goog.date.DateRange.MINIMUM_DATE = new goog.date.Date(0, 0, 1);54/**55 * The last possible day, as far as this class is concerned.56 * @type {goog.date.Date}57 */58goog.date.DateRange.MAXIMUM_DATE = new goog.date.Date(9999, 11, 31);59/**60 * @return {goog.date.Date} The first date in the range.61 */62goog.date.DateRange.prototype.getStartDate = function() {63 return this.startDate_;64};65/**66 * @return {goog.date.Date} The last date in the range.67 */68goog.date.DateRange.prototype.getEndDate = function() {69 return this.endDate_;70};71/**72 * Tests if a date falls within this range.73 *74 * @param {goog.date.Date} date The date to test.75 * @return {boolean} Whether the date is in the range.76 */77goog.date.DateRange.prototype.contains = function(date) {78 return date.valueOf() >= this.startDate_.valueOf() &&79 date.valueOf() <= this.endDate_.valueOf();80};81/**82 * @return {!goog.date.DateRange.Iterator} An iterator over the date range.83 */84goog.date.DateRange.prototype.iterator = function() {85 return new goog.date.DateRange.Iterator(this);86};87/**88 * Tests two {@link goog.date.DateRange} objects for equality.89 * @param {goog.date.DateRange} a A date range.90 * @param {goog.date.DateRange} b A date range.91 * @return {boolean} Whether |a| is the same range as |b|.92 */93goog.date.DateRange.equals = function(a, b) {94 // Test for same object reference; type conversion is irrelevant.95 if (a === b) {96 return true;97 }98 if (a == null || b == null) {99 return false;100 }101 return a.startDate_.equals(b.startDate_) && a.endDate_.equals(b.endDate_);102};103/**104 * Calculates a date that is a number of days after a date. Does not modify its105 * input.106 * @param {goog.date.Date} date The input date.107 * @param {number} offset Number of days.108 * @return {!goog.date.Date} The date that is |offset| days after |date|.109 * @private110 */111goog.date.DateRange.offsetInDays_ = function(date, offset) {112 var newDate = date.clone();113 newDate.add(new goog.date.Interval(goog.date.Interval.DAYS, offset));114 return newDate;115};116/**117 * Calculates a date that is a number of months after the first day in the118 * month that contains its input. Does not modify its input.119 * @param {goog.date.Date} date The input date.120 * @param {number} offset Number of months.121 * @return {!goog.date.Date} The date that is |offset| months after the first122 * day in the month that contains |date|.123 * @private124 */125goog.date.DateRange.offsetInMonths_ = function(date, offset) {126 var newDate = date.clone();127 newDate.setDate(1);128 newDate.add(new goog.date.Interval(goog.date.Interval.MONTHS, offset));129 return newDate;130};131/**132 * Returns the range from yesterday to yesterday.133 * @param {goog.date.Date=} opt_today The date to consider today.134 * Defaults to today.135 * @return {!goog.date.DateRange} The range that includes only yesterday.136 */137goog.date.DateRange.yesterday = function(opt_today) {138 var today = goog.date.DateRange.cloneOrCreate_(opt_today);139 var yesterday = goog.date.DateRange.offsetInDays_(today, -1);140 return new goog.date.DateRange(yesterday, yesterday.clone());141};142/**143 * Returns the range from today to today.144 * @param {goog.date.Date=} opt_today The date to consider today.145 * Defaults to today.146 * @return {!goog.date.DateRange} The range that includes only today.147 */148goog.date.DateRange.today = function(opt_today) {149 var today = goog.date.DateRange.cloneOrCreate_(opt_today);150 return new goog.date.DateRange(today, today.clone());151};152/**153 * Returns the range that includes the seven days that end yesterday.154 * @param {goog.date.Date=} opt_today The date to consider today.155 * Defaults to today.156 * @return {!goog.date.DateRange} The range that includes the seven days that157 * end yesterday.158 */159goog.date.DateRange.last7Days = function(opt_today) {160 var today = goog.date.DateRange.cloneOrCreate_(opt_today);161 var yesterday = goog.date.DateRange.offsetInDays_(today, -1);162 return new goog.date.DateRange(163 goog.date.DateRange.offsetInDays_(today, -7), yesterday);164};165/**166 * Returns the range that starts the first of this month and ends the last day167 * of this month.168 * @param {goog.date.Date=} opt_today The date to consider today.169 * Defaults to today.170 * @return {!goog.date.DateRange} The range that starts the first of this month171 * and ends the last day of this month.172 */173goog.date.DateRange.thisMonth = function(opt_today) {174 var today = goog.date.DateRange.cloneOrCreate_(opt_today);175 return new goog.date.DateRange(176 goog.date.DateRange.offsetInMonths_(today, 0),177 goog.date.DateRange.offsetInDays_(178 goog.date.DateRange.offsetInMonths_(today, 1), -1));179};180/**181 * Returns the range that starts the first of last month and ends the last day182 * of last month.183 * @param {goog.date.Date=} opt_today The date to consider today.184 * Defaults to today.185 * @return {!goog.date.DateRange} The range that starts the first of last month186 * and ends the last day of last month.187 */188goog.date.DateRange.lastMonth = function(opt_today) {189 var today = goog.date.DateRange.cloneOrCreate_(opt_today);190 return new goog.date.DateRange(191 goog.date.DateRange.offsetInMonths_(today, -1),192 goog.date.DateRange.offsetInDays_(193 goog.date.DateRange.offsetInMonths_(today, 0), -1));194};195/**196 * Returns the seven-day range that starts on the first day of the week197 * (see {@link goog.i18n.DateTimeSymbols.FIRSTDAYOFWEEK}) on or before today.198 * @param {goog.date.Date=} opt_today The date to consider today.199 * Defaults to today.200 * @return {!goog.date.DateRange} The range that starts the Monday on or before201 * today and ends the Sunday on or after today.202 */203goog.date.DateRange.thisWeek = function(opt_today) {204 var today = goog.date.DateRange.cloneOrCreate_(opt_today);205 var iso = today.getIsoWeekday();206 var firstDay = today.getFirstDayOfWeek();207 var i18nFirstDay = (iso >= firstDay) ? iso - firstDay : iso + (7 - firstDay);208 var start = goog.date.DateRange.offsetInDays_(today, -i18nFirstDay);209 var end = goog.date.DateRange.offsetInDays_(start, 6);210 return new goog.date.DateRange(start, end);211};212/**213 * Returns the seven-day range that ends the day before the first day of214 * the week (see {@link goog.i18n.DateTimeSymbols.FIRSTDAYOFWEEK}) that215 * contains today.216 * @param {goog.date.Date=} opt_today The date to consider today.217 * Defaults to today.218 * @return {!goog.date.DateRange} The range that starts seven days before the219 * Monday on or before today and ends the Sunday on or before yesterday.220 */221goog.date.DateRange.lastWeek = function(opt_today) {222 var thisWeek = goog.date.DateRange.thisWeek(opt_today);223 var start = goog.date.DateRange.offsetInDays_(thisWeek.getStartDate(), -7);224 var end = goog.date.DateRange.offsetInDays_(thisWeek.getEndDate(), -7);225 return new goog.date.DateRange(start, end);226};227/**228 * Returns the range that starts seven days before the Monday on or before229 * today and ends the Friday before today.230 * @param {goog.date.Date=} opt_today The date to consider today.231 * Defaults to today.232 * @return {!goog.date.DateRange} The range that starts seven days before the233 * Monday on or before today and ends the Friday before today.234 */235goog.date.DateRange.lastBusinessWeek = function(opt_today) {236 // TODO(user): should be i18nized.237 var today = goog.date.DateRange.cloneOrCreate_(opt_today);238 var start =239 goog.date.DateRange.offsetInDays_(today, -7 - today.getIsoWeekday());240 var end = goog.date.DateRange.offsetInDays_(start, 4);241 return new goog.date.DateRange(start, end);242};243/**244 * Returns the range that includes all days between January 1, 1900 and245 * December 31, 9999.246 * @param {goog.date.Date=} opt_today The date to consider today.247 * Defaults to today.248 * @return {!goog.date.DateRange} The range that includes all days between249 * January 1, 1900 and December 31, 9999.250 */251goog.date.DateRange.allTime = function(opt_today) {252 return new goog.date.DateRange(253 goog.date.DateRange.MINIMUM_DATE, goog.date.DateRange.MAXIMUM_DATE);254};255/**256 * Standard date range keys. Equivalent to the enum IDs in257 * DateRange.java http://go/datarange.java258 *259 * @enum {string}260 */261goog.date.DateRange.StandardDateRangeKeys = {262 YESTERDAY: 'yesterday',263 TODAY: 'today',264 LAST_7_DAYS: 'last7days',265 THIS_MONTH: 'thismonth',266 LAST_MONTH: 'lastmonth',267 THIS_WEEK: 'thisweek',268 LAST_WEEK: 'lastweek',269 LAST_BUSINESS_WEEK: 'lastbusinessweek',270 ALL_TIME: 'alltime'271};272/**273 * @param {string} dateRangeKey A standard date range key.274 * @param {goog.date.Date=} opt_today The date to consider today.275 * Defaults to today.276 * @return {!goog.date.DateRange} The date range that corresponds to that key.277 * @throws {Error} If no standard date range with that key exists.278 */279goog.date.DateRange.standardDateRange = function(dateRangeKey, opt_today) {280 switch (dateRangeKey) {281 case goog.date.DateRange.StandardDateRangeKeys.YESTERDAY:282 return goog.date.DateRange.yesterday(opt_today);283 case goog.date.DateRange.StandardDateRangeKeys.TODAY:284 return goog.date.DateRange.today(opt_today);285 case goog.date.DateRange.StandardDateRangeKeys.LAST_7_DAYS:286 return goog.date.DateRange.last7Days(opt_today);287 case goog.date.DateRange.StandardDateRangeKeys.THIS_MONTH:288 return goog.date.DateRange.thisMonth(opt_today);289 case goog.date.DateRange.StandardDateRangeKeys.LAST_MONTH:290 return goog.date.DateRange.lastMonth(opt_today);291 case goog.date.DateRange.StandardDateRangeKeys.THIS_WEEK:292 return goog.date.DateRange.thisWeek(opt_today);293 case goog.date.DateRange.StandardDateRangeKeys.LAST_WEEK:294 return goog.date.DateRange.lastWeek(opt_today);295 case goog.date.DateRange.StandardDateRangeKeys.LAST_BUSINESS_WEEK:296 return goog.date.DateRange.lastBusinessWeek(opt_today);297 case goog.date.DateRange.StandardDateRangeKeys.ALL_TIME:298 return goog.date.DateRange.allTime(opt_today);299 default:300 throw Error('no such date range key: ' + dateRangeKey);301 }302};303/**304 * Clones or creates new.305 * @param {goog.date.Date=} opt_today The date to consider today.306 * Defaults to today.307 * @return {!goog.date.Date} cloned or new.308 * @private309 */310goog.date.DateRange.cloneOrCreate_ = function(opt_today) {311 return opt_today ? opt_today.clone() : new goog.date.Date();312};313/**314 * Creates an iterator over the dates in a {@link goog.date.DateRange}.315 * @constructor316 * @struct317 * @extends {goog.iter.Iterator<goog.date.Date>}318 * @param {goog.date.DateRange} dateRange The date range to iterate.319 * @final320 */321goog.date.DateRange.Iterator = function(dateRange) {322 /**323 * The next date.324 * @type {goog.date.Date}325 * @private326 */327 this.nextDate_ = dateRange.getStartDate().clone();328 /**329 * The end date, expressed as an integer: YYYYMMDD.330 * @type {number}331 * @private332 */333 this.endDate_ = Number(dateRange.getEndDate().toIsoString());334};335goog.inherits(goog.date.DateRange.Iterator, goog.iter.Iterator);336/** @override */337goog.date.DateRange.Iterator.prototype.next = function() {338 if (Number(this.nextDate_.toIsoString()) > this.endDate_) {339 throw goog.iter.StopIteration;340 }341 var rv = this.nextDate_.clone();342 this.nextDate_.add(new goog.date.Interval(goog.date.Interval.DAYS, 1));343 return rv;...

Full Screen

Full Screen

datacube.py

Source:datacube.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2from __future__ import absolute_import, unicode_literals3import datetime4import six5from wechatpy.client.api.base import BaseWeChatAPI6class WeChatDataCube(BaseWeChatAPI):7 API_BASE_URL = 'https://api.weixin.qq.com/datacube/'8 @classmethod9 def _to_date_str(cls, date):10 if isinstance(date, (datetime.datetime, datetime.date)):11 return date.strftime('%Y-%m-%d')12 elif isinstance(date, six.string_types):13 return date14 else:15 raise ValueError('Can not convert %s type to str', type(date))16 def get_user_summary(self, begin_date, end_date):17 """18 获取用户增减数据19 详情请参考20 http://mp.weixin.qq.com/wiki/3/ecfed6e1a0a03b5f35e5efac98e864b7.html21 :param begin_date: 起始日期22 :param end_date: 结束日期23 :return: 统计数据列表24 """25 res = self._post(26 'getusersummary',27 data={28 'begin_date': self._to_date_str(begin_date),29 'end_date': self._to_date_str(end_date)30 }31 )32 return res['list']33 def get_user_cumulate(self, begin_date, end_date):34 """35 获取累计用户数据36 详情请参考37 http://mp.weixin.qq.com/wiki/3/ecfed6e1a0a03b5f35e5efac98e864b7.html38 :param begin_date: 起始日期39 :param end_date: 结束日期40 :return: 统计数据列表41 """42 res = self._post(43 'getusercumulate',44 data={45 'begin_date': self._to_date_str(begin_date),46 'end_date': self._to_date_str(end_date)47 },48 result_processor=lambda x: x['list']49 )50 return res51 def get_interface_summary(self, begin_date, end_date):52 """53 获取接口分析数据54 详情请参考55 http://mp.weixin.qq.com/wiki/8/30ed81ae38cf4f977194bf1a5db73668.html56 :param begin_date: 起始日期57 :param end_date: 结束日期58 :return: 统计数据列表59 """60 res = self._post(61 'getinterfacesummary',62 data={63 'begin_date': self._to_date_str(begin_date),64 'end_date': self._to_date_str(end_date)65 },66 result_processor=lambda x: x['list']67 )68 return res69 def get_interface_summary_hour(self, begin_date, end_date):70 """71 获取接口分析分时数据72 详情请参考73 http://mp.weixin.qq.com/wiki/8/30ed81ae38cf4f977194bf1a5db73668.html74 :param begin_date: 起始日期75 :param end_date: 结束日期76 :return: 统计数据列表77 """78 res = self._post(79 'getinterfacesummaryhour',80 data={81 'begin_date': self._to_date_str(begin_date),82 'end_date': self._to_date_str(end_date)83 },84 result_processor=lambda x: x['list']85 )86 return res87 def get_article_summary(self, begin_date, end_date):88 """89 获取图文群发每日数据90 详情请参考91 http://mp.weixin.qq.com/wiki/8/c0453610fb5131d1fcb17b4e87c82050.html92 :param begin_date: 起始日期93 :param end_date: 结束日期94 :return: 统计数据列表95 """96 res = self._post(97 'getarticlesummary',98 data={99 'begin_date': self._to_date_str(begin_date),100 'end_date': self._to_date_str(end_date)101 },102 result_processor=lambda x: x['list']103 )104 return res105 def get_article_total(self, begin_date, end_date):106 """107 获取图文群发总数据108 详情请参考109 http://mp.weixin.qq.com/wiki/8/c0453610fb5131d1fcb17b4e87c82050.html110 :param begin_date: 起始日期111 :param end_date: 结束日期112 :return: 统计数据列表113 """114 res = self._post(115 'getarticletotal',116 data={117 'begin_date': self._to_date_str(begin_date),118 'end_date': self._to_date_str(end_date)119 },120 result_processor=lambda x: x['list']121 )122 return res123 def get_user_read(self, begin_date, end_date):124 """125 获取图文统计数据126 详情请参考127 http://mp.weixin.qq.com/wiki/8/c0453610fb5131d1fcb17b4e87c82050.html128 :param begin_date: 起始日期129 :param end_date: 结束日期130 :return: 统计数据列表131 """132 res = self._post(133 'getuserread',134 data={135 'begin_date': self._to_date_str(begin_date),136 'end_date': self._to_date_str(end_date)137 },138 result_processor=lambda x: x['list']139 )140 return res141 def get_user_read_hour(self, begin_date, end_date):142 """143 获取图文分时统计数据144 详情请参考145 http://mp.weixin.qq.com/wiki/8/c0453610fb5131d1fcb17b4e87c82050.html146 :param begin_date: 起始日期147 :param end_date: 结束日期148 :return: 统计数据列表149 """150 res = self._post(151 'getuserreadhour',152 data={153 'begin_date': self._to_date_str(begin_date),154 'end_date': self._to_date_str(end_date)155 },156 result_processor=lambda x: x['list']157 )158 return res159 def get_user_share(self, begin_date, end_date):160 """161 获取图文分享转发数据162 详情请参考163 http://mp.weixin.qq.com/wiki/8/c0453610fb5131d1fcb17b4e87c82050.html164 :param begin_date: 起始日期165 :param end_date: 结束日期166 :return: 统计数据列表167 """168 res = self._post(169 'getusershare',170 data={171 'begin_date': self._to_date_str(begin_date),172 'end_date': self._to_date_str(end_date)173 },174 result_processor=lambda x: x['list']175 )176 return res177 def get_user_share_hour(self, begin_date, end_date):178 """179 获取图文分享转发分时数据180 详情请参考181 http://mp.weixin.qq.com/wiki/8/c0453610fb5131d1fcb17b4e87c82050.html182 :param begin_date: 起始日期183 :param end_date: 结束日期184 :return: 统计数据列表185 """186 res = self._post(187 'getusersharehour',188 data={189 'begin_date': self._to_date_str(begin_date),190 'end_date': self._to_date_str(end_date)191 },192 result_processor=lambda x: x['list']193 )194 return res195 def get_upstream_msg(self, begin_date, end_date):196 """197 获取消息发送概况数据198 详情请参考199 http://mp.weixin.qq.com/wiki/12/32d42ad542f2e4fc8a8aa60e1bce9838.html200 :param begin_date: 起始日期201 :param end_date: 结束日期202 :return: 统计数据列表203 """204 res = self._post(205 'getupstreammsg',206 data={207 'begin_date': self._to_date_str(begin_date),208 'end_date': self._to_date_str(end_date)209 },210 result_processor=lambda x: x['list']211 )212 return res213 def get_upstream_msg_hour(self, begin_date, end_date):214 """215 获取消息发送分时数据216 详情请参考217 http://mp.weixin.qq.com/wiki/12/32d42ad542f2e4fc8a8aa60e1bce9838.html218 :param begin_date: 起始日期219 :param end_date: 结束日期220 :return: 统计数据列表221 """222 res = self._post(223 'getupstreammsghour',224 data={225 'begin_date': self._to_date_str(begin_date),226 'end_date': self._to_date_str(end_date)227 },228 result_processor=lambda x: x['list']229 )230 return res231 def get_upstream_msg_week(self, begin_date, end_date):232 """233 获取消息发送周数据234 详情请参考235 http://mp.weixin.qq.com/wiki/12/32d42ad542f2e4fc8a8aa60e1bce9838.html236 :param begin_date: 起始日期237 :param end_date: 结束日期238 :return: 统计数据列表239 """240 res = self._post(241 'getupstreammsgweek',242 data={243 'begin_date': self._to_date_str(begin_date),244 'end_date': self._to_date_str(end_date)245 },246 result_processor=lambda x: x['list']247 )248 return res249 def get_upstream_msg_month(self, begin_date, end_date):250 """251 获取消息发送月数据252 详情请参考253 http://mp.weixin.qq.com/wiki/12/32d42ad542f2e4fc8a8aa60e1bce9838.html254 :param begin_date: 起始日期255 :param end_date: 结束日期256 :return: 统计数据列表257 """258 res = self._post(259 'getupstreammsgmonth',260 data={261 'begin_date': self._to_date_str(begin_date),262 'end_date': self._to_date_str(end_date)263 },264 result_processor=lambda x: x['list']265 )266 return res267 def get_upstream_msg_dist(self, begin_date, end_date):268 """269 获取消息发送分布数据270 详情请参考271 http://mp.weixin.qq.com/wiki/12/32d42ad542f2e4fc8a8aa60e1bce9838.html272 :param begin_date: 起始日期273 :param end_date: 结束日期274 :return: 统计数据列表275 """276 res = self._post(277 'getupstreammsgdist',278 data={279 'begin_date': self._to_date_str(begin_date),280 'end_date': self._to_date_str(end_date)281 },282 result_processor=lambda x: x['list']283 )284 return res285 def get_upstream_msg_dist_week(self, begin_date, end_date):286 """287 获取消息发送分布数据288 详情请参考289 http://mp.weixin.qq.com/wiki/12/32d42ad542f2e4fc8a8aa60e1bce9838.html290 :param begin_date: 起始日期291 :param end_date: 结束日期292 :return: 统计数据列表293 """294 res = self._post(295 'getupstreammsgdistweek',296 data={297 'begin_date': self._to_date_str(begin_date),298 'end_date': self._to_date_str(end_date)299 },300 result_processor=lambda x: x['list']301 )302 return res303 def get_upstream_msg_dist_month(self, begin_date, end_date):304 """305 获取消息发送分布数据306 详情请参考307 http://mp.weixin.qq.com/wiki/12/32d42ad542f2e4fc8a8aa60e1bce9838.html308 :param begin_date: 起始日期309 :param end_date: 结束日期310 :return: 统计数据列表311 """312 res = self._post(313 'getupstreammsgdistmonth',314 data={315 'begin_date': self._to_date_str(begin_date),316 'end_date': self._to_date_str(end_date)317 },318 result_processor=lambda x: x['list']319 )...

Full Screen

Full Screen

calendar.js

Source:calendar.js Github

copy

Full Screen

...117}118function updatePickerFromInput() {119 datepickerStart.setStart($("#date-start").val());120 datepickerStart.setEnd($("#date-end").val());121 datepickerStart.update();122 datepickerEnd.setStart($("#date-start").val());123 datepickerEnd.setEnd($("#date-end").val());124 datepickerEnd.update();125 $('#date-start').trigger('change');126 if ($('#datepicker-compare').attr("checked")) {127 if ($('#compare-options').val() == 1)128 setPreviousPeriod();129 if ($('#compare-options').val() == 2)130 setPreviousYear();131 datepickerStart.setStartCompare($("#date-start-compare").val());132 datepickerStart.setEndCompare($("#date-end-compare").val());133 datepickerEnd.setStartCompare($("#date-start-compare").val());134 datepickerEnd.setEndCompare($("#date-end-compare").val());135 datepickerStart.setCompare(true);136 datepickerEnd.setCompare(true);137 }138}...

Full Screen

Full Screen

test2.py

Source:test2.py Github

copy

Full Screen

...133 plt.xlabel("datetime")134 plt.ylabel("price")135 plt.show()136 pass137def plot_price_flydate(priceModelList):138 leastPrice_list = []139 cDate_list = []140 flyDate_list = []141 dateDifferList = []142 for priceModel in priceModelList:143 c_date = priceModel.cdate144 # print(c_date)145 fly_date = priceModel.flydate146 flyDate_date = datetime.datetime.strptime(fly_date,'%Y-%m-%d')147 cDate_date = datetime.datetime.strptime(c_date,'%Y%m%d')148 # fly_date_int=datetime.datetime.strptime(fly_date,'%Y-%m-%d')149 dateDiffer = (cDate_date - flyDate_date).days150 flyDate_list.append(flyDate_date)151 cDate_list.append(cDate_date)152 leastPrice_list.append(priceModel.leastprice)153 dateDifferList.append(dateDiffer)154 # leastpriceF_list.append(cabinF.leastpriceF)155 print(cDate_list, leastPrice_list)156 print(dateDifferList, leastPrice_list)157 # print(dateDifferList,leastPrice_list)158 # plt.plot(cDate_list,leastPrice_list,"*-")159 plt.plot(dateDifferList, leastPrice_list, "*-")160 plt.xlabel("datetime")161 plt.ylabel("price")162 plt.show()163def plot_main_test(org,dst,cdate="20150209",cabin="Y"):164 if len(org)>3:165 org=City().getCityCode(org)166 dst=City().getCityCode(dst)167 filePathList=getJsonFilePathList(org,dst,cdate)168 # filePathList=getJsonFilePathList(org="BJS",dst="WUH",cdate="20150207")169 # print(filePathList)170 priceModelList=[]171 for filePath in filePathList:172 # print(filePath)173 priceModel=getLeastPriceModel(filePath,cabin=cabin)174 priceModelList.append(priceModel)175 # print(priceModel.printstr())176 plot_price(priceModelList)177 pass178def plot_main_test2(org,dst,flydate="20150227",cabin="Y"):179 if len(org)>3:180 org = City().getCityCode(org)181 dst = City().getCityCode(dst)182 filePathList = getJsonFilePathList_flyDate(org,dst,flydate)183 priceModelList = []184 for filePath in filePathList:185 # print(filePath)186 priceModel = getLeastPriceModel(filePath,cabin=cabin)187 priceModelList.append(priceModel)188 # print(priceModel.printstr())189 # plot_price(priceModelList)190 plot_price_flydate(priceModelList)191 pass192def getLeastPriceModelList(org, dst, flydate, cabin="Y"):193 if len(org)>3:194 org = City().getCityCode(org)195 dst = City().getCityCode(dst)196 filePathList = getJsonFilePathList_flyDate(org,dst,flydate)197 priceModelList = []198 for filePath in filePathList:199 priceModel = getLeastPriceModel(filePath,cabin=cabin)200 priceModelList.append(priceModel)201 return priceModelList202def getLeastDay(org,dst,flydate,cabin="Y"):203 priceModelList = getLeastPriceModelList(org, dst, flydate, cabin)204 #...

Full Screen

Full Screen

Date.js

Source:Date.js Github

copy

Full Screen

1dojo.provide("dojox.date.tests.buddhist.Date");2dojo.require("dojox.date.buddhist");3dojo.require("dojox.date.buddhist.Date");4dojo.require("dojox.date.buddhist.locale");5dojo.requireLocalization("dojo.cldr", "greg");6dojo.requireLocalization("dojo.cldr", "buddhist");7tests.register("dojox.date.tests.buddhist.Date",8 [9 {10 // see tests for dojo.date.locale for setup info11 name: "dojox.date.tests.posix",12 setUp: function(){13 var partLocaleList = ["th"];14 dojo.forEach(partLocaleList, function(locale){15 dojo.requireLocalization("dojo.cldr", "greg", locale);16 dojo.requireLocalization("dojo.cldr", "buddhist", locale);17 });18 },19 runTest: function(t){20 },21 tearDown: function(){22 //Clean up bundles that should not exist if23 //the test is re-run.24 delete dojo.cldr.nls.greg;25 delete dojo.cldr.nls.buddhist;26 }27 },28 {29 name: "toGregorian",30 runTest: function(t){31 var dateBuddhist = new dojox.date.buddhist.Date(2551, 11, 19); //Buddhist.Date month 0-1232 var dateGregorian = dateBuddhist.toGregorian();33 t.is(0, dojo.date.compare(new Date(2008, 11, 19), dateGregorian, "date"));//Date month 0-1134 35 dateBuddhist = new dojox.date.buddhist.Date(2548, 3, 18);36 dateGregorian = dateBuddhist.toGregorian();37 t.is(0, dojo.date.compare(new Date(2005, 3, 18), dateGregorian, "date"));38 39 dateBuddhist = new dojox.date.buddhist.Date(2550, 7, 10);40 dateGregorian = dateBuddhist.toGregorian();41 t.is(0, dojo.date.compare(new Date(2007, 7, 10), dateGregorian, "date"));42 43 dateBuddhist = new dojox.date.buddhist.Date(2552, 4, 20);44 dateGregorian = dateBuddhist.toGregorian();45 t.is(0, dojo.date.compare(new Date(2009, 4, 20), dateGregorian, "date"));46 47 dateBuddhist = new dojox.date.buddhist.Date(2553, 6, 31);48 dateGregorian = dateBuddhist.toGregorian();49 t.is(0, dojo.date.compare(new Date(2010, 6, 31), dateGregorian, "date"));50 51 dateBuddhist = new dojox.date.buddhist.Date(2554, 9, 1);52 dateGregorian = dateBuddhist.toGregorian();53 t.is(0, dojo.date.compare(new Date(2011, 9, 1), dateGregorian, "date"));54 }55 },56 {57 name: "fromGregorian",58 runTest: function(t){59 var dateGregorian = new Date(2009, 3, 12);60 var dateBuddhistFromGreg = new dojox.date.buddhist.Date(dateGregorian);61 t.is(0, dojo.date.compare( dateBuddhistFromGreg.toGregorian(), dateGregorian, "date"));62 t.is(0, dojo.date.compare( dateBuddhistFromGreg.toGregorian(), dateGregorian));63 64 dateGregorian = new Date(2008, 11, 18); //Date month 0-1165 dateBuddhistFromGreg = new dojox.date.buddhist.Date(dateGregorian);66 t.is(0, dojox.date.buddhist.compare(new dojox.date.buddhist.Date(2551, 11, 18), dateBuddhistFromGreg, "date")); //Buddhist.Date month 0-1267 68 dateGregorian = new Date(2005, 3, 18);69 dateBuddhistFromGreg = new dojox.date.buddhist.Date(dateGregorian);70 t.is(0, dojox.date.buddhist.compare(new dojox.date.buddhist.Date(2548, 3, 18), dateBuddhistFromGreg, "date"));71 72 dateGregorian = new Date(2007, 7, 10);73 dateBuddhistFromGreg = new dojox.date.buddhist.Date(dateGregorian);74 t.is(0, dojox.date.buddhist.compare(new dojox.date.buddhist.Date(2550, 7, 10), dateBuddhistFromGreg, "date"));75 76 dateGregorian = new Date(2009, 4, 20);77 dateBuddhistFromGreg = new dojox.date.buddhist.Date(dateGregorian);78 t.is(0, dojox.date.buddhist.compare(new dojox.date.buddhist.Date(2552, 4, 20), dateBuddhistFromGreg, "date"));79 80 dateGregorian = new Date(2010, 6, 31);81 dateBuddhistFromGreg = new dojox.date.buddhist.Date(dateGregorian);82 t.is(0, dojox.date.buddhist.compare(new dojox.date.buddhist.Date(2553, 6, 31), dateBuddhistFromGreg, "date"));83 84 dateGregorian = new Date(2011, 9, 1);85 dateBuddhistFromGreg = new dojox.date.buddhist.Date(dateGregorian);86 t.is(0, dojox.date.buddhist.compare(new dojox.date.buddhist.Date(2554, 9, 1), dateBuddhistFromGreg, "date"));87 }88 },89 {90 name: "compare",91 runTest: function(t){92 var dateBuddhist = new dojox.date.buddhist.Date(2552, 5, 16);93 var dateBuddhist1 = new dojox.date.buddhist.Date(2550, 10, 25);94 t.is(1, dojo.date.compare(dateBuddhist.toGregorian(), dateBuddhist1.toGregorian()));95 t.is(-1, dojo.date.compare(dateBuddhist1.toGregorian(), dateBuddhist.toGregorian()));96 }97 },98 {99 name: "add_and_difference",100 runTest: function(t){101 var dateBuddhist = new dojox.date.buddhist.Date(2552, 5, 16);102 var dateBuddhistLeap = new dojox.date.buddhist.Date(2551, 5, 16);103 104 var dateBuddhistAdd = dojox.date.buddhist.add(dateBuddhist, "month", 18);105 var dateBuddhistAddLeap = dojox.date.buddhist.add(dateBuddhistLeap, "month", 18);106 t.is(0, 18 - dojox.date.buddhist.difference(dateBuddhistAdd, dateBuddhist, "month"));107 t.is(0, 18 - dojox.date.buddhist.difference(dateBuddhistAddLeap, dateBuddhistLeap, "month"));108 109 var dateBuddhistAdd1= dojox.date.buddhist.add(dateBuddhist, "year", 2);110 t.is(0, 2 - dojox.date.buddhist.difference(dateBuddhistAdd1, dateBuddhist, "year"));111 t.is(0, 2 - dojox.date.buddhist.difference(dojox.date.buddhist.add(dateBuddhistLeap, "year", 2), dateBuddhistLeap, "year"));112 113 var dateBuddhistAdd2= dojox.date.buddhist.add(dateBuddhist, "week", 12);114 t.is(0, 12 - dojox.date.buddhist.difference(dateBuddhistAdd2, dateBuddhist, "week"));115 t.is(0, 12 - dojox.date.buddhist.difference(dojox.date.buddhist.add(dateBuddhistLeap, "week", 12), dateBuddhistLeap,"week"));116 117 var dateBuddhistAdd3= dojox.date.buddhist.add(dateBuddhist, "weekday", 20);118 t.is(0, 20 - dojox.date.buddhist.difference(dateBuddhistAdd3, dateBuddhist, "weekday"));119 t.is(0, 20 - dojox.date.buddhist.difference(dojox.date.buddhist.add(dateBuddhistLeap, "weekday", 20), dateBuddhistLeap,"weekday"));120 121 var dateBuddhistAdd4= dojox.date.buddhist.add(dateBuddhist, "day", -50)122 t.is(0, -50 - dojox.date.buddhist.difference(dateBuddhistAdd4, dateBuddhist, "day"));123 t.is(0, -50 - dojox.date.buddhist.difference(dojox.date.buddhist.add(dateBuddhistLeap, "day", -50), dateBuddhistLeap,"day"));124 125 var dateBuddhistAdd5= dojox.date.buddhist.add(dateBuddhist, "hour", 200);126 t.is(0, 200 - dojox.date.buddhist.difference(dateBuddhistAdd5, dateBuddhist, "hour"));127 t.is(0, 200 - dojox.date.buddhist.difference(dojox.date.buddhist.add(dateBuddhistLeap, "hour", 200), dateBuddhistLeap,"hour"));128 129 var dateBuddhistAdd6= dojox.date.buddhist.add(dateBuddhist, "minute", -200);130 t.is(0, -200 - dojox.date.buddhist.difference(dateBuddhistAdd6, dateBuddhist, "minute"));131 t.is(0, -200 - dojox.date.buddhist.difference(dojox.date.buddhist.add(dateBuddhistLeap, "minute", -200), dateBuddhistLeap,"minute"));132 133 var dateBuddhistDiff = new dojox.date.buddhist.Date(2552, 5, 17);134 t.is(1, dojox.date.buddhist.difference(dateBuddhistDiff, dateBuddhist));135 }136 },137 {138 name: "parse_and_format",139 runTest: function(t){140 var dateBuddhist = new dojox.date.buddhist.Date(2552, 5, 16);141 142 var options = {formatLength:'short'};143 str= dojox.date.buddhist.locale.format(dateBuddhist, options);144 dateBuddhist1 = dojox.date.buddhist.locale.parse(str, options);145 t.is(0, dojo.date.compare(dateBuddhist.toGregorian(), dateBuddhist1.toGregorian(), 'date'));146 147 var pat = 'dd/MM/yy h:m:s';148 options = {datePattern:pat, selector:'date'};149 str= dojox.date.buddhist.locale.format(dateBuddhist, options);150 dateBuddhist1 = dojox.date.buddhist.locale.parse(str, options);151 t.is(0, dojo.date.compare(dateBuddhist.toGregorian(), dateBuddhist1.toGregorian(), 'date'));152 153 pat = 'dd#MM#yy HH$mm$ss';154 options = {datePattern:pat, selector:'date'};155 str= dojox.date.buddhist.locale.format(dateBuddhist, options);156 dateBuddhist1 = dojox.date.buddhist.locale.parse(str, options);157 t.is(0, dojo.date.compare(dateBuddhist.toGregorian(), dateBuddhist1.toGregorian(), 'date'));158 159 160 pat = 'HH$mm$ss';161 options = {timePattern:pat, selector:'time'};162 str= dojox.date.buddhist.locale.format(dateBuddhist, options);163 dateBuddhist1 = dojox.date.buddhist.locale.parse(str, options);164 gregDate = dojo.date.locale.parse(str, options);165 t.is(0, dojo.date.compare(gregDate, dateBuddhist1.toGregorian(), 'time'));166 167 }168 }169 ]...

Full Screen

Full Screen

dateutil.py

Source:dateutil.py Github

copy

Full Screen

...27 def getfirst_insecond(date_str_src, fmt_src):28 date_str_dest = DateUtil.str2str(date_str_src, fmt_src, '%Y-%m-%d')29 return date_str_dest + " 00:00:00"30 @staticmethod31 def get_date(year, month, day):32 date = datetime.datetime(year, month, day)33 @staticmethod34 def get_date_str(year, month, day):35 date = datetime.datetime(year, month, day)36 return DateUtil.date2str(date, '%Y-%m-%d')37 @staticmethod38 def is_leap(year):39 if year%4 != 0:40 return False41 else:42 if year%100 == 0 and year%400 != 0:43 return False44 else:45 return True46 @staticmethod47 def get_daysofmonth(year, month):48 if month in [1, 3, 5, 7, 8, 10, 12]:49 return 3150 elif month in [4, 6, 9, 11]:51 return 3052 else:53 if DateUtil.is_leap(year):54 return 2955 else:56 return 2857 @staticmethod58 def is_weekend(date_str, fmt='%Y-%m-%d'):59 date = DateUtil.str2date(date_str, fmt)60 return DateUtil.is_weekend2(date)61 @staticmethod62 def is_weekend2(date):63 dayofweek = date.isoweekday()64 if dayofweek in [6, 7]:65 return True66 else:67 return False68 @staticmethod69 def get_weekendsofmonth(year, month):70 days = DateUtil.get_daysofmonth(year, month)71 weekends = []72 for i in range(days):73 tmp_date = datetime.datetime(year, month, i+1)74 if DateUtil.is_weekend2(tmp_date):75 weekends.append(DateUtil.date2str(tmp_date, '%Y-%m-%d'))76 return weekends77 @staticmethod78 def get_worktimeofday(date):79 plus1 = datetime.timedelta(hours=8)80 plus2 = datetime.timedelta(hours=18)81 date_start = date+plus182 date_end = date+plus283 return DateUtil.date2str(date_start), DateUtil.date2str(date_end)84 @staticmethod85 def get_weektimeofmonth(year, month):86 days = DateUtil.get_daysofmonth(year, month)87 weekdays_start = []88 weekdays_end = []89 for i in range(days):90 tmp_date = datetime.datetime(year, month, i+1)91 if not DateUtil.is_weekend2(tmp_date):92 tmp_start, tmp_end = DateUtil.get_worktimeofday(tmp_date)93 weekdays_start.append(tmp_start)94 weekdays_end.append(tmp_end)95 return weekdays_start, weekdays_end96 @staticmethod97 def date2str(date, fmt_dst='%Y-%m-%d %H:%M:%S'):98 if not date:99 return None100 return date.strftime(fmt_dst)101 @staticmethod102 def str2date(date_str, fmt_dst='%Y-%m-%d %H:%M:%S'):103 return datetime.datetime.strptime(date_str, fmt_dst)104 @staticmethod105 def minus_days(date_str1, date_str2, fmt='%Y-%m-%d'):106 minus = DateUtil.str2date(date_str2, fmt)-DateUtil.str2date(date_str1, fmt)107 return minus.days108 @staticmethod109 def minus_insecond(date_str1, date_str2, fmt='%Y-%m-%d %H:%M:%S'):110 minus = DateUtil.str2date(date_str2, fmt) - DateUtil.str2date(date_str1, fmt)111 return minus.seconds112 @staticmethod113 def plus_hours(date_str, num, fmt='%Y-%m-%d %H:%M:%S'):114 date_dst = DateUtil.str2date(date_str, '%Y-%m-%d')+datetime.timedelta(hours=num)115 return DateUtil.date2str(date_dst, fmt)116 @staticmethod117 def minus_seconds(date, num, fmt='%Y-%m-%d %H:%M:%S'):118 date_dst = date-datetime.timedelta(seconds=num)119 return DateUtil.date2str(date_dst, fmt)120 @staticmethod121 def minus_minutes(date_str, num, fmt='%Y-%m-%d %H:%M:%S'):122 date = DateUtil.str2date(date_str)123 date_dst = date-datetime.timedelta(minutes=num)124 return DateUtil.date2str(date_dst, fmt)125 @staticmethod126 def plus_minutes(date_str, num, fmt='%Y-%m-%d %H:%M:%S'):127 return DateUtil.minus_minutes(date_str, -num, fmt)128 @staticmethod129 def now_date():130 return datetime.datetime.now()131 @staticmethod132 def yeaterday_str(fmt='%Y-%m-%d'):133 yesterday = DateUtil.now_date() - datetime.timedelta(days=1)134 return DateUtil.date2str(yesterday, fmt)135 @staticmethod136 def plus_days(date_str1, num, fmt='%Y-%m-%d'):137 date_dst = DateUtil.str2date(date_str1, fmt)+datetime.timedelta(days=num)138 return DateUtil.date2str(date_dst, fmt)139 @staticmethod140 def from_to(date_str_from, date_str_to, fmt='%Y-%m-%d'):141 days = DateUtil.minus_days(date_str_from, date_str_to, fmt)142 for i in range(days):143 yield DateUtil.plus_days(date_str_from, i, fmt)144 #@staticmethod145 #def get_worktime(year, month):146def test():147 #print DateUtil.str2str('2013-04-12', '%Y-%m-%d', '%Y-%m-%d %H:%M:%S')148 #print DateUtil.getlast_insecond('2013-04-12', '%Y-%m-%d')149 #print DateUtil.getfirst_insecond('2013-04-12 12:12:12', '%Y-%m-%d %H:%M:%S')150 #print DateUtil.minus_days('2013-04-13', '2013-04-15')151 #print DateUtil.plus_days('2013-05-09', 9)...

Full Screen

Full Screen

other.ts

Source:other.ts Github

copy

Full Screen

1import * as DateFns from 'date-fns';2import {enUS, ru} from 'date-fns/locale';3export default class DateFormat {4 static LOCALE = process.env.NEXT_PUBLIC_LOCALE === 'en' ? enUS : ru;5 static FORMATS = {6 default: 'dd.MM.yyyy',7 fullMonth: 'dd MMMM yyyy',8 };9 static today = (): DateFormat => {10 const dateFormat = new DateFormat();11 dateFormat.date = new Date();12 return dateFormat;13 };14 static fromISO = (iso: string): DateFormat => {15 const dateFormat = new DateFormat();16 dateFormat.fromISO(iso);17 return dateFormat;18 };19 static fromDate = (date: Date): DateFormat => {20 const dateFormat = new DateFormat();21 dateFormat.fromDate(date);22 return dateFormat;23 };24 static min = (dateFormats: Array<DateFormat | undefined>): DateFormat | undefined => {25 let min: DateFormat | undefined;26 dateFormats.forEach(dateFormat => {27 if (dateFormat?.date === undefined) return;28 if (min === undefined || (min.date !== undefined && dateFormat.date < min.date))29 min = dateFormat;30 });31 return min;32 };33 static max = (dateFormats: Array<DateFormat | undefined>): DateFormat | undefined => {34 let max: DateFormat | undefined;35 dateFormats.forEach(dateFormat => {36 if (dateFormat?.date === undefined) return;37 if (max === undefined || (max.date !== undefined && dateFormat.date > max.date))38 max = dateFormat;39 });40 return max;41 };42 static differenceInDays = (43 a: DateFormat | undefined,44 b: DateFormat | undefined45 ): number | undefined => {46 if (!a?.date || !b?.date) return;47 return DateFns.differenceInDays(a.date, b.date);48 };49 date: Date | undefined;50 fromISO = (iso: string): void => {51 this.date = DateFns.parseISO(iso);52 };53 fromDate = (date: Date): void => {54 this.date = date;55 };56 isBefore = (dateFormat: DateFormat | undefined): boolean | undefined => {57 if (dateFormat?.date === undefined) return;58 if (this.date === undefined) return;59 return DateFns.isBefore(this.date, dateFormat.date);60 };61 isAfter = (dateFormat: DateFormat | undefined): boolean | undefined => {62 if (dateFormat?.date === undefined) return;63 if (this.date === undefined) return;64 return DateFns.isAfter(this.date, dateFormat.date);65 };66 isPast = (): boolean | undefined => {67 if (this.date === undefined) return;68 return DateFns.isPast(this.date);69 };70 isFuture = (): boolean | undefined => {71 if (this.date === undefined) return;72 return DateFns.isFuture(this.date);73 };74 toString = (): string | undefined => {75 return this.default;76 };77 addDays = (days: number): DateFormat | undefined => {78 if (this.date === undefined) return;79 const dateFormat = new DateFormat();80 dateFormat.date = DateFns.addDays(this.date, days);81 return dateFormat;82 };83 addMonths = (months: number): DateFormat | undefined => {84 if (this.date === undefined) return;85 const dateFormat = new DateFormat();86 dateFormat.date = DateFns.addMonths(this.date, months);87 return dateFormat;88 };89 isSameMonth = (dateFormat: DateFormat | undefined): boolean | undefined => {90 if (this.date === undefined || dateFormat?.date === undefined) return;91 return DateFns.isSameMonth(this.date, dateFormat.date);92 };93 isSameYear = (dateFormat: DateFormat | undefined): boolean | undefined => {94 if (this.date === undefined || dateFormat?.date === undefined) return;95 return DateFns.isSameYear(this.date, dateFormat.date);96 };97 startOfMonth = (): DateFormat | undefined => {98 if (this.date === undefined) return;99 const dateFormat = new DateFormat();100 dateFormat.date = DateFns.startOfMonth(this.date);101 return dateFormat;102 };103 endOfMonth = (): DateFormat | undefined => {104 if (this.date === undefined) return;105 const dateFormat = new DateFormat();106 dateFormat.date = DateFns.endOfMonth(this.date);107 return dateFormat;108 };109 getDaysInMonth = (): number | undefined => {110 if (this.date === undefined) return;111 return DateFns.getDaysInMonth(this.date);112 };113 getDaysInYear = (): number | undefined => {114 if (this.date === undefined) return;115 return DateFns.getDaysInYear(this.date);116 };117 get default(): string | undefined {118 return this.format(DateFormat.FORMATS.default);119 }120 format = (format = DateFormat.FORMATS.default): string | undefined => {121 if (!this.date) return;122 return DateFns.format(this.date, format, {locale: DateFormat.LOCALE});123 };...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2const { date } = require('fast-check-monorepo');3const dateArb = date();4fc.assert(5 fc.property(dateArb, (d) => {6 console.log(d);7 })8);

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require("fast-check");2const date = require("fast-check-monorepo/date");3const { DateTime } = require("luxon");4fc.assert(5 fc.property(date(), (d) => {6 return DateTime.fromJSDate(d) instanceof DateTime;7 })8);9 throw err;10 at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)11 at Function.Module._load (internal/modules/cjs/loader.js:725:27)12 at Module.require (internal/modules/cjs/loader.js:952:19)13 at require (internal/modules/cjs/helpers.js:88:18)14 at Object.<anonymous> (/Users/xxxx/Documents/xxxxx/test3.js:3:16)15 at Module._compile (internal/modules/cjs/loader.js:1063:30)16 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)17 at Module.load (internal/modules/cjs/loader.js:928:32)18 at Function.Module._load (internal/modules/cjs/loader.js:769:14)19 at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {20}21const fc = require("fast-check");22const date = require("fast-check/date");23const { DateTime } = require("luxon");24fc.assert(25 fc.property(date(), (d) => {26 return DateTime.fromJSDate(d) instanceof DateTime;27 })28);

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2const { date } = require('fast-check-monorepo');3const { isDate } = require('lodash');4fc.assert(5 fc.property(date(), (d) => {6 console.log(d);7 return isDate(d);8 })9);10const fc = require('fast-check');11const { date } = require('fast-check-monorepo');12const { isDate } = require('lodash');13fc.assert(14 fc.property(date(), (d) => {15 console.log(d);16 return isDate(d);17 })18);19const fc = require('fast-check');20const { date } = require('fast-check-monorepo');21const { isDate } = require('lodash');22fc.assert(23 fc.property(date(), (d) => {24 console.log(d);25 return isDate(d);26 })27);28const fc = require('fast-check');29const { date } = require('fast-check-monorepo');30const { isDate } = require('lodash');31fc.assert(32 fc.property(date(), (d) => {33 console.log(d);34 return isDate(d);35 })36);37const fc = require('fast-check');38const { date } = require('fast-check-monorepo');39const { isDate } = require('lodash');40fc.assert(41 fc.property(date(), (d) => {42 console.log(d);43 return isDate(d);44 })45);46const fc = require('fast-check');47const { date } = require('fast-check-monorepo');48const { isDate } = require('lodash');49fc.assert(50 fc.property(date(), (d) => {51 console.log(d);52 return isDate(d);53 })54);55const fc = require('fast-check');56const { date } = require('fast-check-monorepo');57const { isDate } = require('lodash

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2console.log(fc.date());3const fc1 = require('fast-check/lib/check/arbitrary/DateArbitrary');4console.log(fc1.date());5const fc1 = require('fast-check/lib/check/arbitrary/DateArbitrary');6console.log(fc1.date());7const fc = require('fast-check');8console.log(fc.date());9const fc = require('fast-check');10console.log(fc.date());11const fc1 = require('fast-check/lib/check/arbitrary/DateArbitrary');12console.log(fc1.date());13const fc = require('fast-check');14console.log(fc.date());15const fc1 = require('fast-check/lib/check/arbitrary/DateArbitrary');16console.log(fc1.date());17const fc = require('fast-check');18console.log(fc.date());19const fc1 = require('fast-check/lib/check/arbitrary/DateArbitrary');20console.log(fc1.date());21const fc = require('fast-check');22console.log(fc.date());23const fc1 = require('fast-check/lib/check/arbitrary/DateArbitrary');24console.log(fc1.date());25const fc = require('fast-check');26console.log(fc.date());27const fc1 = require('fast-check/lib/check/arbitrary/DateArbitrary');28console.log(fc1.date());29const fc = require('fast-check');30console.log(fc.date());

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require("fast-check");2const { date } = require("fast-check");3const dateArb = date({ min: new Date(0), max: new Date(100) });4fc.assert(5 fc.property(dateArb, (d) => {6 return d.getTime() >= 0 && d.getTime() <= 100;7 })8);9const fc = require("fast-check");10const { date } = require("fast-check");11const dateArb = date({ min: new Date(0), max: new Date(100) });12fc.assert(13 fc.property(dateArb, (d) => {14 return d.getTime() >= 0 && d.getTime() <= 100;15 })16);17const fc = require("fast-check");18const { date } = require("fast-check");19const dateArb = date({ min: new Date(0), max: new Date(100) });20fc.assert(21 fc.property(dateArb, (d) => {22 return d.getTime() >= 0 && d.getTime() <= 100;23 })24);25const fc = require("fast-check");26const { date } = require("fast-check");27const dateArb = date({ min: new Date(0), max: new Date(100) });28fc.assert(29 fc.property(dateArb, (d) => {30 return d.getTime() >= 0 && d.getTime() <= 100;31 })32);33const fc = require("fast-check");34const { date } = require("fast-check");35const dateArb = date({ min: new Date(0), max: new Date(100) });36fc.assert(37 fc.property(dateArb, (d) => {38 return d.getTime() >= 0 && d.getTime() <= 100;39 })40);41const fc = require("fast-check");42const { date } = require("fast-check");43const dateArb = date({ min: new

Full Screen

Using AI Code Generation

copy

Full Screen

1const date = require('fast-check-monorepo/date');2console.log(date);3const date = require('fast-check-monorepo');4console.log(date);5const date = require('fast-check-monorepo/lib/date');6console.log(date);7const date = require('fast-check-monorepo/lib/date.js');8console.log(date);9const date = require('fast-check-monorepo/src/date.js');10console.log(date);11const date = require('fast-check-monorepo/src/date');12console.log(date);13const date = require('fast-check-monorepo/date.js');14console.log(date);15const date = require('fast-check-monorepo/lib/date');16console.log(date);17const date = require('fast-check-monorepo/src/date');18console.log(date);19const date = require('fast-check-monorepo/lib/src/date');20console.log(date);21const date = require('fast-check-monorepo/lib/src/date.js');22console.log(date);

Full Screen

Using AI Code Generation

copy

Full Screen

1const { date } = require('fast-check');2const { DateTime } = require('luxon');3const { isDate } = require('lodash/isDate');4const { isInteger } = require('lodash/isInteger');5const { isString } = require('lodash/isString');6const { isBoolean } = require('lodash/isBoolean');7const isDateValid = (d) => {8 return (9 isDate(d) &&10 isInteger(d.getTime()) &&11 isString(d.toISOString()) &&12 isBoolean(d.toISOString().includes('T'))13 );14};15const isDateTimeValid = (d) => {16 return (17 isDate(d) &&18 isInteger(d.toMillis()) &&19 isString(d.toISO()) &&20 isBoolean(d.toISO().includes('T'))21 );22};23describe('date', () => {24 it('should be able to generate valid date', () => {25 const arb = date();26 for (let idx = 0; idx !== 1000; ++idx) {27 const d = arb.generate(mrng());28 expect(isDateValid(d)).toBe(true);29 }30 });31 it('should be able to generate valid DateTime', () => {32 const arb = date();33 for (let idx = 0; idx !== 1000; ++idx) {34 const d = arb.generate(mrng());35 expect(isDateTimeValid(DateTime.fromJSDate(d))).toBe(true);36 }37 });38 it('should be able to shrink towards valid date', () => {39 const arb = date();40 for (let idx = 0; idx !== 1000; ++idx) {41 const d = arb.generate(mrng());42 const shrink = arb.shrink(d, mrng());43 let previous = d;44 for (let idx = 0; idx !== 1000; ++idx) {45 const s = shrink.next().value;46 if (s === undefined) break;47 expect(isDateValid(s)).toBe(true);48 expect(s.getTime()).toBeLessThanOrEqual(previous.getTime());49 previous = s;50 }51 }52 });53 it('should be able to shrink towards valid DateTime', () => {54 const arb = date();55 for (let idx = 0; idx !== 1000; ++idx) {56 const d = arb.generate(mrng());57 const shrink = arb.shrink(d, mrng());

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fast-check-monorepo automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful