Compare commits

..

1 Commits

Author SHA1 Message Date
GotPPay
591d7be308 round time to the nearest 5 min 2018-05-11 17:24:40 +02:00
2 changed files with 29 additions and 27 deletions

View File

@@ -2340,19 +2340,19 @@ html.static.boxed {
@font-face { @font-face {
font-family: 'Lato'; font-family: 'Lato';
src: url(/fonts/lato/lato-regular-webfont.woff2) format("woff2"), url(/fonts/lato/lato-regular-webfont.woff) format("woff"); src: url(/assets/./fonts/646474e48f4c1ea783f43ac5e41fd111.woff2) format("woff2"), url(/assets/./fonts/374df2a818582454b6e6832804e52f86.woff) format("woff");
font-weight: bold; font-weight: bold;
font-style: normal; } font-style: normal; }
@font-face { @font-face {
font-family: 'Lato'; font-family: 'Lato';
src: url(/assets/./fonts/lato/lato-bolditalic-webfont.woff2) format("woff2"), url(/assets/./fonts/lato/lato-bolditalic-webfont.woff) format("woff"); src: url(/assets/./fonts/5fa6d7ddc0a0d53311752343d7176d70.woff2) format("woff2"), url(/assets/./fonts/c53136193516ed2d4fac337d1dc6965a.woff) format("woff");
font-weight: bold; font-weight: bold;
font-style: italic; } font-style: italic; }
@font-face { @font-face {
font-family: 'Lato'; font-family: 'Lato';
src: url(/assets/./fonts/lato/lato-italic-webfont.woff2) format("woff2"), url(/assets/./fonts/lato/lato-italic-webfont.woff) format("woff"); src: url(/assets/./fonts/9bcf055a732c0b22d2279ba79e20c577.woff2) format("woff2"), url(/assets/./fonts/c8eef482ac448a91ecca9d008634c044.woff) format("woff");
font-weight: normal; font-weight: normal;
font-style: italic; } font-style: italic; }

View File

@@ -34,7 +34,7 @@ import Checkbox from 'material-ui/Checkbox';
import Popover from 'material-ui/Popover'; import Popover from 'material-ui/Popover';
let DateTimeFormat; let DateTimeFormat;
const roundingTime = 1000 * 60 * 5; //5 minutes
DateTimeFormat = global.Intl.DateTimeFormat; DateTimeFormat = global.Intl.DateTimeFormat;
@@ -416,16 +416,18 @@ class VerticalNonLinear extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
let dateNow = new Date();
this.state = { this.state = {
stepIndex: 0, stepIndex: 0,
rideTypeValue: 0, rideTypeValue: 0,
providerID: 0, providerID: 0,
providerName: '', providerName: '',
visitDate: new Date(), visitDate: new Date(),
visitTime: new Date(), visitTime: new Date(Math.round(dateNow.getTime() / roundingTime) * roundingTime),
pickupLocation: null, pickupLocation: null,
pickupTime: new Date(), pickupTime: new Date(Math.round(dateNow.getTime() / roundingTime) * roundingTime),
pickupTimeReturn: new Date(), pickupTimeReturn: new Date(Math.round(dateNow.getTime() / roundingTime) * roundingTime),
pickupTimeReturnDisplayMode: 'none', pickupTimeReturnDisplayMode: 'none',
open: false, open: false,
message: 'Booking Ride', message: 'Booking Ride',
@@ -489,10 +491,10 @@ class VerticalNonLinear extends React.Component {
} }
}); });
let visitTime = new Date(new Date().getTime() + (1 * 60 * 60 * 1000)); let visitTime = new Date(Math.round((date.getTime() + (1 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
let visitDate = visitTime; let visitDate = date;
let pickupTime = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000)); let pickupTime = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
let pickupTimeReturn = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000)); let pickupTimeReturn = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
this.setState(Object.assign(this.state, { this.setState(Object.assign(this.state, {
visitDate: visitDate, visitDate: visitDate,
@@ -600,10 +602,10 @@ class VerticalNonLinear extends React.Component {
handleDate(event, date, state) { handleDate(event, date, state) {
let self = state let self = state
let visitTime = new Date(date.getTime() + (1 * 60 * 60 * 1000)); let visitTime = new Date(Math.round((date.getTime() + (1 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
let visitDate = date; let visitDate = date;
let pickupTime = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000)); let pickupTime = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
let pickupTimeReturn = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000)); let pickupTimeReturn = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
self.setState(Object.assign(self.state, { self.setState(Object.assign(self.state, {
visitDate: visitDate, visitDate: visitDate,