Skip to content

Instantly share code, notes, and snippets.

import React, {Component} from 'react';
import 'react-dates/initialize';
import {DateRangePicker, initialStartDate, isInclusivelyAfterDay} from 'react-dates';
import {START_DATE, END_DATE} from 'react-dates/constants';
import ReactDOM from 'react-dom';
import isSameDay from './utils/isSameDay';
import moment from "moment/moment";
import checkStatus from "./utils/checkFetchStatus";
import swal from 'sweetalert';
import 'whatwg-fetch';
import React, {Component} from 'react';
import 'react-dates/initialize';
import {DateRangePicker, initialStartDate, isInclusivelyAfterDay} from 'react-dates';
import {START_DATE, END_DATE} from 'react-dates/constants';
import ReactDOM from 'react-dom';
import isSameDay from './utils/isSameDay';
import moment from "moment/moment";
import fetchPrices from './utils/fetchPrices';
let disabledDates = [];
const Encore = require('@symfony/webpack-encore');
Encore
.setOutputPath('public/build')
.setPublicPath('/build')
.setManifestKeyPrefix('')
.splitEntryChunks()
.addEntry('js/test', './public/assets/js/test.js')// JAVASCRIPT
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
(function (root, factory) {
var routing = factory();
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], routing.Routing);
} else if (typeof module === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = routing.Routing;
<template>
<datepicker
:startDate="startDate"
@check-in-changed="setCheckInDate"
@check-out-changed="setCheckOutDate"
:maxNights="21"
:minNights="minNights"
:checkIn="checkIn"
:checkOut="checkOut"
:disabledDates="bookedDates"
<template>
<datepicker
:startDate="startDate"
@checkInChanged="setCheckinDate"
:maxNights="30"
:disabledDates="bookedDates"
:firstDayOfWeek="1"
:i18n="lang"
:showYear="true"
>
@heleneshaikh
heleneshaikh / Fetch
Last active October 29, 2018 18:14
Fetch with polyfill and error wrapper
import 'whatwg-fetch'; //polyfill
window.fetch(Routing.generate('booking_data'), { //window.fetch -> polyfill
method: 'post',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({
checkin: event.start.toDateString(),