From c33f53c2a0339beaf5130f4ff9b5cf6c31552295 Mon Sep 17 00:00:00 2001 From: Darya Palitsyna Date: Mon, 27 May 2024 18:16:28 +0500 Subject: [PATCH 1/5] ui-blocker --- src/const.js | 8 +++++++- src/presenter/trip-presenter.js | 12 +++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/const.js b/src/const.js index 32797ad..03dd705 100644 --- a/src/const.js +++ b/src/const.js @@ -105,6 +105,11 @@ const ButtonLabels = { SAVE_IN_PROGRESS: 'Saving...' }; +const TimeLimit = { + LOWER_LIMIT: 350, + UPPER_LIMIT: 1000, +} + export {POINT_EMPTY, POINT_TYPE, DESTINATION, @@ -117,4 +122,5 @@ export {POINT_EMPTY, EditingType, UpdateType, Method, - ButtonLabels}; + ButtonLabels, + TimeLimit}; diff --git a/src/presenter/trip-presenter.js b/src/presenter/trip-presenter.js index b2e4f3e..bdb32ce 100644 --- a/src/presenter/trip-presenter.js +++ b/src/presenter/trip-presenter.js @@ -3,6 +3,7 @@ import EventListEmptyView from '../view/event-list-empty-view.js'; import SortPointsView from '../view/sort-points-view.js'; import LoadingView from '../view/loading-view.js'; +import UiBlocker from '../framework/ui-blocker/ui-blocker.js' import { remove, render, RenderPosition } from '../framework/render.js'; import PointPresenter from './point-presenter.js'; @@ -10,7 +11,7 @@ import NewPointPresenter from './new-point-presenter.js'; import { sortPointsByTime, sortPointsByPrice } from '../utils/points.js'; import { filter } from '../utils/filter.js'; -import { SortType, UserAction, UpdateType, FilterType } from '../const.js'; +import { SortType, UserAction, UpdateType, FilterType, TimeLimit } from '../const.js'; //import EditPointView from '../view/editing-form-view.js'; export default class TripPresenter { @@ -29,6 +30,11 @@ export default class TripPresenter { #filterType = FilterType.EVERYTHING; #isLoading = true; + #uiBlocker = new UiBlocker({ + lowerLimit: TimeLimit.LOWER_LIMIT, + upperLimit: TimeLimit.UPPER_LIMIT + }); + #pointPresenters = new Map(); #newPointPresenter = null; @@ -146,6 +152,8 @@ export default class TripPresenter { }; #handleViewAction = async (actionType, updateType, update) => { + this.#uiBlocker.block(); + switch(actionType) { case UserAction.UPDATE_POINT: this.#pointPresenters.get(update.id).setSaving(); @@ -172,6 +180,8 @@ export default class TripPresenter { } break; } + + this.#uiBlocker.unblock(); }; #clearBoard = ({resetSortType = false} = {}) => { From b89ebbec3502b9fecda44650621a01886eeddd3f Mon Sep 17 00:00:00 2001 From: Darya Palitsyna Date: Mon, 27 May 2024 19:45:49 +0500 Subject: [PATCH 2/5] =?UTF-8?q?8.8.=20=D0=94=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD?= =?UTF-8?q?=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=B0=D1=8F=20=D1=84=D1=83?= =?UTF-8?q?=D0=BD=D0=BA=D1=86=D0=B8=D0=BE=D0=BD=D0=B0=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 3 - src/const.js | 45 +---- src/main.js | 5 +- src/template/additional-new-point-template.js | 94 ---------- src/template/editing-form-template.js | 164 +++++++++--------- src/template/trip-info-template.js | 72 +++++++- src/utils/common.js | 33 +++- src/utils/points.js | 4 +- src/utils/trip-info.js | 20 +++ src/view/additional-new-point-view.js | 13 -- src/view/trip-info-view.js | 13 +- 11 files changed, 228 insertions(+), 238 deletions(-) delete mode 100644 src/template/additional-new-point-template.js create mode 100644 src/utils/trip-info.js delete mode 100644 src/view/additional-new-point-view.js diff --git a/public/index.html b/public/index.html index 44c26b4..d90e695 100644 --- a/public/index.html +++ b/public/index.html @@ -21,9 +21,6 @@

Filter events

- - -
diff --git a/src/const.js b/src/const.js index 03dd705..1025205 100644 --- a/src/const.js +++ b/src/const.js @@ -1,8 +1,11 @@ const DEFAULT_TYPE = 'taxi'; +const AUTHORIZATION = 'Basic mofy87osm1d'; +const END_POINT = 'https://21.objects.htmlacademy.pro/big-trip'; + //пустая точка const POINT_EMPTY = { - basePrice: 0, + basePrice: 1, dateFrom: null, dateTo: null, destination: null, @@ -23,37 +26,6 @@ const POINT_TYPE = [ 'Restaurant' ]; -const DESTINATION = [ - 'Ekaterinburg', - 'Moscow', - 'Tokyo', - 'Kawaguchiko', - 'Shibuya', - 'Harayuki', - 'Roppongi', - 'Kyoto', - 'Gose Palace', - 'Kinkaku-ji', - 'Hiroshima', - 'Miyajima Island', - 'Nikko Park' -]; - -const DESCRIPTION = [ - 'Nullam nunc ex, convallis sed finibus eget, sollicitudin eget ante.', - 'Phasellus eros mauris, condimentum sed nibh vitae, sodales efficitur ipsum.', - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', - 'Aliquam erat volutpat.' -]; - -const OFFERS = [ - 'Add luggage', - 'Switch to comfort class', - 'Add meal', - 'Choose seats', - 'Travel by train', -]; - const FilterType = { EVERYTHING: 'everything', FUTURE: 'future', @@ -66,11 +38,11 @@ const Mode = { EDITING: 'EDITING', }; -const SortType = [{ +const SortType = { DAY: 'day', TIME: 'time', PRICE: 'price' -}]; +}; const UserAction = { UPDATE_POINT: 'UPDATE_POINT', @@ -111,10 +83,9 @@ const TimeLimit = { } export {POINT_EMPTY, + AUTHORIZATION, + END_POINT, POINT_TYPE, - DESTINATION, - DESCRIPTION, - OFFERS, FilterType, Mode, SortType, diff --git a/src/main.js b/src/main.js index c6d8a99..4d53d0d 100644 --- a/src/main.js +++ b/src/main.js @@ -12,11 +12,8 @@ import FilterModel from './model/filter-model.js'; import PointsApiService from './api-service/points-api-service.js'; -const AUTHORIZATION = 'Basic mofy87osm1d'; -const END_POINT = 'https://21.objects.htmlacademy.pro/big-trip'; +import { AUTHORIZATION, END_POINT } from './const.js'; -//const filterHeaderElement = document.querySelector('.trip-controls'); -//const siteFilterElement = filterHeaderElement.querySelector('.trip-controls__filters'); const siteMainElement = document.querySelector('.page-main'); const tripInfoElement = document.querySelector('.trip-main'); diff --git a/src/template/additional-new-point-template.js b/src/template/additional-new-point-template.js deleted file mode 100644 index 33263c7..0000000 --- a/src/template/additional-new-point-template.js +++ /dev/null @@ -1,94 +0,0 @@ -import { POINT_TYPE, OFFERS } from '../const'; -import { formatFullDate } from '../utils/day'; -import { getRandomValue } from '../utils/common'; - -function createNewPointTemplate(point){ - return `
  • -
    -
    -
    - - - -
    -
    - Event type - - ${POINT_TYPE.map((type) => `
    - - -
    `).join('')} -
    -
    -
    - -
    - - - - - - - -
    - -
    - - - — - - -
    - -
    - - -
    - - - -
    -
    -
    -

    Offers

    - -
    - ${OFFERS.map((offer) => `
    - - -
    `).join('')} -
    -
    - -
    -

    Destination

    -

    Geneva is a city in Switzerland that lies at the southern tip of expansive Lac Léman (Lake Geneva). Surrounded by the Alps and Jura mountains, the city has views of dramatic Mont Blanc.

    - -
    -
    - Event photo - Event photo - Event photo - Event photo - Event photo -
    -
    -
    -
    -
    -
  • `; -} - -export {createNewPointTemplate}; diff --git a/src/template/editing-form-template.js b/src/template/editing-form-template.js index 9762045..e12c597 100644 --- a/src/template/editing-form-template.js +++ b/src/template/editing-form-template.js @@ -1,20 +1,19 @@ -import { POINT_TYPE, OFFERS, ButtonLabels, EditingType } from '../const'; +import { POINT_TYPE, /* OFFERS, */ ButtonLabels, EditingType } from '../const'; import { formatFullDate } from '../utils/day'; import { getRandomValue } from '../utils/common'; import he from 'he'; function createPointType(pointId, currentType, isDisabled) { - return POINT_TYPE.map((type) => `
    - - -
    `).join(''); + return POINT_TYPE.map((type) => + `
    + + +
    `).join(''); } function createPointOffer() { return OFFERS.map((offer) => `
    - +
    `).join(''); } -function generateDestinations(destinations) { +function createPointPictures(destination) { + return ( + `
    +
    + ${destination.pictures.map((picture) => + `${picture.description}`).join('')} +
    +
    ` + ); +} + +function createDestination( destination ) { + return destination.descriptions.length && destination.pictures.length ? `
    +

    Destination

    + ${destination.description.length ? `

    ${destination.description}

    ` : ''} + ${destination.pictures.length ? createPointPictures(destination) : ''} +
    ` : ''; +} + +function createPointDestinations(destinations) { return ( `${destinations.map((destination) => ``).join('')} `); } @@ -60,79 +78,67 @@ function createControlsButtonsTemplate({ type, isSaving, isDeleting, isDisabled ${type === EditingType.UPDATE ? createRollupButton(isDisabled) : ''}`; } -function createEditPointTemplate({state, pointDestinations, /* pointOffers */}) { +function createEditPointTemplate({state, pointDestinations, pointOffers}) { const { point, isDisabled, isSaving, isDeleting } = state; - const { id, price, /* dateFrom, dateTo, offers, */ type } = point; - const currentDestination = pointDestinations.find((destination) => destination.id === point.destination); - //const currentOffers = pointOffers.find((offer) => offer.type === type); + const { id, price, dateFrom, dateTo, offers, type } = point; + const currentDestination = pointDestinations.find((destination) => destination.id === point.destinations); + const currentOffers = pointOffers.find((offer) => offer.type === type); const destinationName = (currentDestination) ? currentDestination.name : ''; - return `
  • -
    -
    -
    - - - -
    -
    - Event type - ${createPointType(id, type, isDisabled)} -
    -
    -
    - -
    - - - - ${generateDestinations(pointDestinations)} - -
    - -
    - - - — - - -
    - -
    - - -
    - - ${createControlsButtonsTemplate({ type, isSaving, isDeleting, isDisabled })} -
    -
    -
    -

    Offers

    - -
    - ${createPointOffer()} -
    -
    - -
    -

    Destination

    -

    Chamonix-Mont-Blanc (usually shortened to Chamonix) is a resort area near the junction of France, Switzerland and Italy. At the base of Mont Blanc, the highest summit in the Alps, it's renowned for its skiing.

    -
    -
    -
    -
  • `; + return (` +
  • +
    +
    +
    + + +
    +
    + Event type + ${createPointType(id, type, isDisabled)} +
    +
    +
    +
    + + + + ${createPointDestinations(destinations)} + +
    +
    + + + — + + +
    +
    + + +
    + + ${createControlsButtonsTemplate({ type, isSaving, isDeleting, isDisabled })} +
    +
    +
    +

    Offers

    + ${createPointOffer(currentOffers, offers, isDisabled)} +
    + ${currentDestination ? `
    + ${createDestination(currentDestination)} +
    ` : ''} +
    +
    +
  • `); } export {createEditPointTemplate}; diff --git a/src/template/trip-info-template.js b/src/template/trip-info-template.js index 7f958ab..e541ddd 100644 --- a/src/template/trip-info-template.js +++ b/src/template/trip-info-template.js @@ -1,13 +1,75 @@ -function createTripInfoTemplate() { +import { humanizePointDate } from '../utils/points'; +import { getStartPoint, getEndPoint } from '../utils/common'; + + + +function getTotalPrice(points, offers) { + if (points.length === 0) { + return ''; + } + let totalPrice = 0; + points.forEach((point) => { + + if (offers.length === 0) { + return 0; + } + + let pricePointOffers = 0; + const offersByType = offers.find((offer) => offer.type === point.type); + const pointOffers = point.offers; + + pointOffers.forEach((offer) => { + pricePointOffers += offersByType.offers.find((item) => item.id === offer).price; + }); + + totalPrice += point.basePrice; + totalPrice += pricePointOffers; + }); + + return `Total: € ${totalPrice}`; +} + +function getDates(points) { + if (points.length === 0) { + return ''; + } + + const startPoint = getStartPoint(points); + const endPoint = getEndPoint(points); + + return `

    ${humanizePointDate(startPoint.startDate, 'MMM D')} — ${humanizePointDate(endPoint.endDate, 'MMM D')}

    ` +} + +function getRouteTrip(points, destinations) { + if (points.length === 0) { + return ''; + } + const route = [points[0].destination]; + for (let i = 1; i < points.length; i++) { + if (points[i].destination !== points[i - 1].destination) { + route.push(points[i].destination); + } + } + + if (route.length > 3) { + const startPoint = destinations.find((item) => item.id === route[0]); + const endPoint = destinations.find((item) => item.id === route[route.length - 1]); + return `${startPoint.name} — ... — ${endPoint.name}`; + } + + return route.map((destination) => `${destinations.find((item) => item.id === destination).name}`).join(' — '); + +}; + +function createTripInfoTemplate(points, destinations, offers) { return `
    -

    Amsterdam — Chamonix — Geneva

    - -

    Mar 18 — 20

    +

    ${getRouteTrip(points, destinations)}

    + ${getDates(points)}

    - Total: € 1230 + ${getTotalPrice(points, offers)}

    `; } diff --git a/src/utils/common.js b/src/utils/common.js index d0f578e..8920f70 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -2,4 +2,35 @@ function getRandomValue(lower = 0, upper = 1000) { return Math.round((upper - lower) * Math.random() + lower); } -export { getRandomValue }; +const getStartPoint = (points) => { + let startPoint = points[0]; + for(let i = 1; i < points.length; i++) { + const currPointDate = points[i].startDate; + const currentPointDate = points[i].startDate; + const endPointDate = startPoint.startDate; + if(dayjs(currPointDate).diff(dayjs(endPointDate), 'M') < 0 + || dayjs(currPointDate).diff(dayjs(endPointDate), 'M') === 0 + && dayjs(currPointDate).diff(dayjs(endPointDate), 'D') < 0) { + if(dayjs(currentPointDate).diff(dayjs(endPointDate), 'M') < 0 + || dayjs(currentPointDate).diff(dayjs(endPointDate), 'M') === 0 + && dayjs(currentPointDate).diff(dayjs(endPointDate), 'D') < 0) { + startPoint = points[i]; + } + } + return startPoint; + } +}; + +const getEndPoint = (points) => { + let endPoint = points[0]; + for(let i = 1; i < points.length; i++) { + const currentPointDate = points[i].endDate; + if(dayjs(currentPointDate).diff(dayjs(endPointDate), 'M') > 0 + || dayjs(currentPointDate).diff(dayjs(endPointDate), 'M') === 0 + && dayjs(currentPointDate).diff(dayjs(endPointDate), 'D') > 0) { + endPoint = points[i]; + } + } + return endPoint; +} +export { getRandomValue, getStartPoint, getEndPoint }; diff --git a/src/utils/points.js b/src/utils/points.js index 92f660d..525525e 100644 --- a/src/utils/points.js +++ b/src/utils/points.js @@ -23,6 +23,8 @@ function sortPointsByPrice(pointA, pointB){ } } +const humanizePointDate = (date, form) => dayjs(date).format(form); + function isDatesEqual(dateA, dateB) { return (dateA === null && dateB === null) || dayjs(dateA).isSame(dateB, 'D'); } @@ -31,4 +33,4 @@ function isPriceEqual(priceA, priceB) { return priceA === priceB; } -export {sortPointsByPrice, sortPointsByTime, sortPointsByDay, isDatesEqual, isPriceEqual}; +export {sortPointsByPrice, sortPointsByTime, sortPointsByDay, isDatesEqual, isPriceEqual, humanizePointDate}; diff --git a/src/utils/trip-info.js b/src/utils/trip-info.js new file mode 100644 index 0000000..9a3bdcb --- /dev/null +++ b/src/utils/trip-info.js @@ -0,0 +1,20 @@ +getTripTitle = () => { + +}; + +getOffersCost = (offerIds = [], offers = []) => { + return offerIds.reduce((result, id) => result + (offers.find((offer) => offer.id === id)?.price ?? 0),0); +} + +getTripCost = (points = [], offers = []) => { + return points.reduce( + (result, point) => result + point.basePrice + getOffersCost(point.offers, offers.find((offer) => point.type === offer.type)?.offers), + 0 + ); +}; + +getTripDuration = () => { + +}; + +export {getTripCost, getTripDuration, getTripTitle}; diff --git a/src/view/additional-new-point-view.js b/src/view/additional-new-point-view.js deleted file mode 100644 index ed7515f..0000000 --- a/src/view/additional-new-point-view.js +++ /dev/null @@ -1,13 +0,0 @@ -import AbstractView from '../framework/view/abstract-view.js'; -import { createNewPointTemplate } from '../template/additional-new-point-template.js'; - -export default class NewPointView extends AbstractView { - constructor({point}) { - super(); - this.point = point; - } - - get template() { - return createNewPointTemplate(this.point); - } -} diff --git a/src/view/trip-info-view.js b/src/view/trip-info-view.js index 7b9a689..2eafded 100644 --- a/src/view/trip-info-view.js +++ b/src/view/trip-info-view.js @@ -2,7 +2,18 @@ import AbstractView from '../framework/view/abstract-view.js'; import { createTripInfoTemplate } from '../template/trip-info-template.js'; export default class TripInfoView extends AbstractView { + #destinations = null; + #offers = null; + #points = 0; + + constructor({destinations, offers, points}) { + super(); + this.#destinations = destinations; + this.#offers = offers; + this.#points = points; + } + get template() { - return createTripInfoTemplate(); + return createTripInfoTemplate(this.#points, this.#destinations, this.#offers); } } From f2bfb7076c76d388bea01df98409c7ab78149f7a Mon Sep 17 00:00:00 2001 From: Darya Palitsyna Date: Mon, 27 May 2024 19:57:48 +0500 Subject: [PATCH 3/5] =?UTF-8?q?8.8.=20=D0=94=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD?= =?UTF-8?q?=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=B0=D1=8F=20=D1=84=D1=83?= =?UTF-8?q?=D0=BD=D0=BA=D1=86=D0=B8=D0=BE=D0=BD=D0=B0=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/const.js | 2 +- src/presenter/trip-presenter.js | 2 +- src/template/editing-form-template.js | 26 ++++++++++++++------------ src/template/trip-info-template.js | 8 +++----- src/utils/common.js | 2 ++ 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/const.js b/src/const.js index 1025205..b886953 100644 --- a/src/const.js +++ b/src/const.js @@ -80,7 +80,7 @@ const ButtonLabels = { const TimeLimit = { LOWER_LIMIT: 350, UPPER_LIMIT: 1000, -} +}; export {POINT_EMPTY, AUTHORIZATION, diff --git a/src/presenter/trip-presenter.js b/src/presenter/trip-presenter.js index bdb32ce..05290bf 100644 --- a/src/presenter/trip-presenter.js +++ b/src/presenter/trip-presenter.js @@ -3,7 +3,7 @@ import EventListEmptyView from '../view/event-list-empty-view.js'; import SortPointsView from '../view/sort-points-view.js'; import LoadingView from '../view/loading-view.js'; -import UiBlocker from '../framework/ui-blocker/ui-blocker.js' +import UiBlocker from '../framework/ui-blocker/ui-blocker.js'; import { remove, render, RenderPosition } from '../framework/render.js'; import PointPresenter from './point-presenter.js'; diff --git a/src/template/editing-form-template.js b/src/template/editing-form-template.js index e12c597..f5ccb04 100644 --- a/src/template/editing-form-template.js +++ b/src/template/editing-form-template.js @@ -11,15 +11,17 @@ function createPointType(pointId, currentType, isDisabled) { `).join(''); } -function createPointOffer() { - return OFFERS.map((offer) => `
    - - -
    `).join(''); +function createPointOffer(offers, point, isDisabled) { + return offers.map((offer) => ` +
    + + +
    `).join(''); } function createPointPictures(destination) { @@ -113,10 +115,10 @@ function createEditPointTemplate({state, pointDestinations, pointOffers}) {
    - + - +
    diff --git a/src/utils/common.js b/src/utils/common.js index 80f7788..8d5179e 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -13,10 +13,10 @@ const getStartPoint = (points) => { if(dayjs(currPointDate).diff(dayjs(endPointDate), 'M') < 0 || dayjs(currPointDate).diff(dayjs(endPointDate), 'M') === 0 && dayjs(currPointDate).diff(dayjs(endPointDate), 'D') < 0) { - if(dayjs(currentPointDate).diff(dayjs(endPointDate), 'M') < 0 - || dayjs(currentPointDate).diff(dayjs(endPointDate), 'M') === 0 - && dayjs(currentPointDate).diff(dayjs(endPointDate), 'D') < 0) { - startPoint = points[i]; + if(dayjs(currentPointDate).diff(dayjs(endPointDate), 'M') < 0 + || dayjs(currentPointDate).diff(dayjs(endPointDate), 'M') === 0 + && dayjs(currentPointDate).diff(dayjs(endPointDate), 'D') < 0) { + startPoint = points[i]; } } return startPoint; @@ -27,12 +27,13 @@ const getEndPoint = (points) => { let endPoint = points[0]; for(let i = 1; i < points.length; i++) { const currentPointDate = points[i].endDate; - if(dayjs(currentPointDate).diff(dayjs(endPointDate), 'M') > 0 + /* if(dayjs(currentPointDate).diff(dayjs(endPointDate), 'M') > 0 || dayjs(currentPointDate).diff(dayjs(endPointDate), 'M') === 0 && dayjs(currentPointDate).diff(dayjs(endPointDate), 'D') > 0) { endPoint = points[i]; - } + } */ } return endPoint; -} +}; + export { getRandomValue, getStartPoint, getEndPoint }; diff --git a/src/utils/trip-info.js b/src/utils/trip-info.js deleted file mode 100644 index 9a3bdcb..0000000 --- a/src/utils/trip-info.js +++ /dev/null @@ -1,20 +0,0 @@ -getTripTitle = () => { - -}; - -getOffersCost = (offerIds = [], offers = []) => { - return offerIds.reduce((result, id) => result + (offers.find((offer) => offer.id === id)?.price ?? 0),0); -} - -getTripCost = (points = [], offers = []) => { - return points.reduce( - (result, point) => result + point.basePrice + getOffersCost(point.offers, offers.find((offer) => point.type === offer.type)?.offers), - 0 - ); -}; - -getTripDuration = () => { - -}; - -export {getTripCost, getTripDuration, getTripTitle}; From 025dd3d86e12ab416819f34cb4cb1bab61248c58 Mon Sep 17 00:00:00 2001 From: Darya Palitsyna Date: Mon, 27 May 2024 20:05:03 +0500 Subject: [PATCH 5/5] =?UTF-8?q?8.8.=20=D0=94=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD?= =?UTF-8?q?=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=B0=D1=8F=20=D1=84=D1=83?= =?UTF-8?q?=D0=BD=D0=BA=D1=86=D0=B8=D0=BE=D0=BD=D0=B0=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/common.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/common.js b/src/utils/common.js index 8d5179e..ac7d0a1 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -16,7 +16,7 @@ const getStartPoint = (points) => { if(dayjs(currentPointDate).diff(dayjs(endPointDate), 'M') < 0 || dayjs(currentPointDate).diff(dayjs(endPointDate), 'M') === 0 && dayjs(currentPointDate).diff(dayjs(endPointDate), 'D') < 0) { - startPoint = points[i]; + startPoint = points[i]; } } return startPoint; @@ -24,9 +24,9 @@ const getStartPoint = (points) => { }; const getEndPoint = (points) => { - let endPoint = points[0]; + const endPoint = points[0]; for(let i = 1; i < points.length; i++) { - const currentPointDate = points[i].endDate; + //const currentPointDate = points[i].endDate; /* if(dayjs(currentPointDate).diff(dayjs(endPointDate), 'M') > 0 || dayjs(currentPointDate).diff(dayjs(endPointDate), 'M') === 0 && dayjs(currentPointDate).diff(dayjs(endPointDate), 'D') > 0) {