Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'moment-range' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
import PropTypes from 'prop-types';
import { toastr } from 'react-redux-toastr';
import Moment from 'moment';
import { extendMoment } from 'moment-range';
// Redux
import { connect } from 'react-redux';
import { toggleTooltip } from 'redactions/tooltip';
// Services
import DatasetService from 'components/widgets/editor/services/DatasetService';
// Components
import Button from 'components/widgets/editor/ui/Button';
const moment = extendMoment(Moment);
class FilterDateTooltip extends React.Component {
constructor(props) {
super(props);
this.state = {
values: []
};
// DatasetService
this.datasetService = new DatasetService(props.datasetID, {
apiURL: process.env.WRI_API_URL,
language: props.locale
});
}
const TCFormFields = FormsyForm.Fields
// import enhanceDropdown from 'appirio-tech-react-components/components/Dropdown/enhanceDropdown'
import { updatePhase as updatePhaseAction, firePhaseDirty, firePhaseDirtyUndo } from '../../../actions/project'
import LoadingIndicator from '../../../../components/LoadingIndicator/LoadingIndicator'
import SelectDropdown from '../../../../components/SelectDropdown/SelectDropdown'
import { PHASE_STATUS_COMPLETED, PHASE_STATUS, PHASE_STATUS_ACTIVE, PHASE_STATUS_DRAFT } from '../../../../config/constants'
import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip'
import { TOOLTIP_DEFAULT_DELAY } from '../../../../config/constants'
import { getPhaseActualData } from '../../../../helpers/projectHelper'
import DeletePhase from './DeletePhase'
import {
ROLE_CONNECT_ADMIN,
ROLE_ADMINISTRATOR,
} from '../../../../config/constants'
const moment = extendMoment(Moment)
const phaseStatuses = PHASE_STATUS.map(ps => ({
title: ps.name,
value: ps.value,
}))
class EditStageForm extends React.Component {
constructor(props) {
super(props)
this.state = {
isUpdating: false,
isEdittable: (_.get(props, 'phase.status') !== PHASE_STATUS_COMPLETED) || (_.get(props, 'isAdmin')),
disableActiveStatusFields: _.get(props, 'phase.status') !== PHASE_STATUS_ACTIVE,
showPhaseOverlapWarning: false,
phaseIsdirty: false,
showActivatingWarning: false,
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import Moment from 'moment-timezone';
// eslint-disable-next-line
import { extendMoment } from 'moment-range';
import { ClickOutside } from '../ClickOutside';
import { Input } from '../Form';
import { IconButton } from '../Button';
const moment = extendMoment(Moment);
const defaultDateFormat = 'l';
const placeholderDateFormat = 'L';
const iso8601DateFormat = 'YYYY-MM-DD';
const defaultTranslations = {
inputFieldError: '',
inputFieldLabel: 'Date',
today: 'Today',
};
export class DatepickerRaw extends Component {
/**
* Renders visible weekdays
* @return {ReactElement} thead
*/
static renderWeekHeader() {
import Moment from 'moment';
import { extendMoment } from 'moment-range';
import cssModules from 'react-css-modules';
import React from 'react';
import PropTypes from 'prop-types';
import momentPropTypes from 'react-moment-proptypes';
import SettingsEthernet from 'material-ui/svg-icons/action/settings-ethernet';
import _ from 'lodash';
import styles from './availability-grid.css';
const moment = extendMoment(Moment);
// calculate the numbers of cells to offset the hours grid
// since we only want display the full hours
const initialOffSet = (allTimes) => {
if (allTimes[0].minutes() !== 0) {
return 4 - (allTimes[0].minutes() / 15);
}
return 0;
};
// depois
const cellForOffsetAfterjump = (jumpIndexAllTimes, allTimes) => {
const nextfullHour = moment(allTimes[jumpIndexAllTimes]).startOf('hour').add(1, 'h');
const numCells = nextfullHour.diff(moment(allTimes[jumpIndexAllTimes]), 'minutes') / 15;
const cell = (numCells < 4) ? <div style="{{"> : null;
return cell;</div>
/* Copyright IBM Corp, All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
import { Router } from 'express'
const Chain = require("../../../modules/chain");
import ChainModel from '../../../models/chain'
import ChainCode from '../../../models/chainCode'
import util from 'util'
import config from '../../../config'
import Moment from 'moment'
import { extendMoment } from 'moment-range';
const moment = extendMoment(Moment);
const log4js = require('log4js');
const logger = log4js.getLogger(__filename.slice(__dirname.length + 1));
const logLevel = process.env.DEV === "True" ? "DEBUG" : "INFO"
logger.setLevel(logLevel);
const router = new Router()
router.get("/:apikey/list", function(req, res) {
const chain = new Chain(req.apikey, req.username);
chain.list(req.query.page).then(function(result) {
res.json({
...result,
limit: config.limit.chainNumber
});
}).catch(function(err) {
res.json(err);
// Generate some random bids reports to use with charts until the AdEx node ready
import { Bid } from 'adex-models'
import Helper from 'helpers/miscHelpers'
import Moment from 'moment'
import { extendMoment } from 'moment-range'
const moment = extendMoment(Moment)
const AVAILABLE_SLOTS = 2000000 // 2 000 000
const BID_STEP_SLOTS = 10000 // 10 000 (Just for the random data)
const BID_PER_SLOT_AMOUNT_STEP = 1
const MIN_BID_PER_SLOT_AMOUNT = BID_PER_SLOT_AMOUNT_STEP * 5 // 5 cents
const TOTAL_BIDS = 10
const MAX_BID_PER_SLOT_AMOUNT = MIN_BID_PER_SLOT_AMOUNT * 20 // Just for the random data
class AuctionBidsGenerator {
constructor() {
this.auctionBids = this.generateSomeRandomAuctionBids()
}
generateSomeRandomAuctionBids() {
let firstPoints = AVAILABLE_SLOTS
let firstBidAmountPerSlot = MIN_BID_PER_SLOT_AMOUNT
beforeEach(() => {
moment = extendMoment(Moment);
onChangeMock.mockClear();
});
export const weekDays = timeline => {
const dayFormat = 'YYYY-MM-DD'
const startOfWeek = timeline.startOf('week').format(dayFormat)
const endOfWeek = timeline.endOf('week').format(dayFormat)
const week = extendMoment(moment).range(startOfWeek, endOfWeek).by('days')
return Array.from(week).map(day => day.format(dayFormat))
}
/**
* Created by lixuc on 2017/5/3.
*/
var rp = require("request-promise");
var configuration = require("./configuration");
var dt = require("../kit/date-tool");
var Pagination = require("../kit/pagination");
import Moment from 'moment'
import { extendMoment } from 'moment-range';
import util from 'util'
import config from '../config'
import sleep from 'sleep-promise';
const crypto = require("crypto");
const mongoose = require('mongoose');
const moment = extendMoment(Moment);
const log4js = require('log4js');
const logger = log4js.getLogger(__filename.slice(__dirname.length + 1));
const logLevel = process.env.DEV === "True" ? "DEBUG" : "INFO"
import ChainModel from '../models/chain'
import ChainCode from '../models/chainCode'
logger.setLevel(logLevel);
function chain(apikey, username) {
this.apikey = apikey;
this.username = username;
}
chain.prototype = {
RESTfulURL: "http://" + configuration.RESTful_Server + configuration.RESTful_BaseURL,
PoolManagerURL: "http://" + configuration.PoolManager_Server + configuration.PoolManager_BaseURL,
LogURL: "http://" + configuration.Log_Server + configuration.Log_BaseURL,
amount: function() {
import Moment from 'moment';
import {
createSelector,
createSelectorCreator,
defaultMemoize,
} from 'reselect';
import { extendMoment } from 'moment-range';
import {
ADD_APPOINTMENTS,
REMOVE_APPOINTMENTS,
} from '../actions/appointment-actions';
import { REMOVE_COURSE } from '../actions/course-actions';
import { WEEKLY, BIWEEKLY } from '../lib/recurrence';
const moment = extendMoment(Moment);
export type AppointmentsPerDay = Array>;
const INITITAL_STATE = {};
export default function reducer(
state: AppointmentsState = INITITAL_STATE,
action: Action,
) {
switch (action.type) {
case ADD_APPOINTMENTS:
return {
...state,
...action.appointments,
};
case REMOVE_APPOINTMENTS: