This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {addDays, format, isAfter, isBefore, startOfDay} from 'date-fns'; | |
| import React, {Component, Fragment} from 'react'; | |
| import classes from 'classnames'; | |
| import DatePickerDialog from './DatePickerDialog'; | |
| import Dialog from 'components/Dialog'; | |
| import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; | |
| import {getDisabled} from '../../../utils/component'; | |
| import PropTypes from 'prop-types'; | |
| import './index.css'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /usr/share/zoneinfo/Hongkong | |
| > Wed Jan 01 2014 00:00:00 GMT+0800 (HKT) | |
| > Mon Sep 01 2014 00:00:00 GMT+0800 (HKT) | |
| /usr/share/zoneinfo/Pacific/Easter | |
| > Wed Jan 01 2014 00:00:00 GMT-0500 (EASST) | |
| > Mon Sep 01 2014 00:00:00 GMT-0600 (EAST) | |
| /usr/share/zoneinfo/Pacific/Norfolk | |
| > Wed Jan 01 2014 00:00:00 GMT+1130 (NFT) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| // First let's create an array of JavaScript Date | |
| // objects. | |
| // More info about the Date class: | |
| // http://w3schools.com/js/js_obj_date.asp | |
| var dates = [ | |
| new Date(2010, 4, 10, 10, 07, 16), | |
| new Date(2010, 4, 8, 9, 16, 09), | |
| new Date(2010, 3, 30, 0, 15, 49), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Returns an array of dates between the two dates | |
| function getDates (startDate, endDate) { | |
| const dates = [] | |
| let currentDate = startDate | |
| const addDays = function (days) { | |
| const date = new Date(this.valueOf()) | |
| date.setDate(date.getDate() + days) | |
| return date | |
| } | |
| while (currentDate <= endDate) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //http://blog.stevenlevithan.com/archives/date-time-format | |
| //http://stevenlevithan.com/assets/misc/date.format.js | |
| /* | |
| * Date Format 1.2.3 | |
| * (c) 2007-2009 Steven Levithan <stevenlevithan.com> | |
| * MIT license | |
| * | |
| * Includes enhancements by Scott Trenda <scott.trenda.net> | |
| * and Kris Kowal <cixar.com/~kris.kowal/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| DependencyList, | |
| Dispatch, | |
| MutableRefObject, | |
| SetStateAction, | |
| useCallback, | |
| useEffect, | |
| useRef, | |
| useState | |
| } from 'react'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * "document_id" -> "document id" | |
| * "documentId" -> "document id" | |
| */ | |
| export const toSpaces = (str: string): string => | |
| str && str | |
| .replace(/[-_]/g, ' ') | |
| .replace(/([A-Z])/g, ' $1'); | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {useMemo} from 'react'; | |
| /** | |
| * Prevents React.DOM from replacing methods inside hooks. | |
| */ | |
| const ref = { | |
| log: console.log, | |
| error: console.error, | |
| debug: console.debug | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {DependencyList, useEffect, useMemo} from 'react'; | |
| export const useInterval = ( | |
| callback: () => void, | |
| ms: number, | |
| deps: DependencyList | |
| ) => { | |
| const all_deps = useMemo( | |
| () => [callback, ms, ...deps], | |
| // eslint-disable-next-line react-hooks/exhaustive-deps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {FC, useEffect} from 'react'; | |
| export interface RepeaterProps { | |
| disabled?: boolean; | |
| emitFirst?: boolean; | |
| onRepeat: () => void; | |
| speed: number; |
NewerOlder