diff --git a/package-lock.json b/package-lock.json index edf45eb..3dce15b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "clean-webpack-plugin": "4.0.0", "dayjs": "1.11.6", - "flatpickr": "4.6.13", + "flatpickr": "^4.6.13", "he": "1.2.0", "html-webpack-plugin": "5.6.0" }, @@ -20,10 +20,10 @@ "@webpack-cli/generators": "3.0.7", "babel-loader": "9.1.0", "copy-webpack-plugin": "11.0.0", - "css-loader": "^6.7.3", + "css-loader": "6.7.3", "eslint": "8.28.0", "eslint-config-htmlacademy": "8.0.0", - "style-loader": "^3.3.2", + "style-loader": "3.3.2", "webpack": "5.75.0", "webpack-cli": "5.0.0", "webpack-dev-server": "4.11.1" diff --git a/public/index.html b/public/index.html index 44c26b4..a29324b 100644 --- a/public/index.html +++ b/public/index.html @@ -21,8 +21,6 @@

Filter events

- - diff --git a/src/const.js b/src/const.js index 00275d2..4780da7 100644 --- a/src/const.js +++ b/src/const.js @@ -13,7 +13,7 @@ const UPDATE_TYPE = { MAJOR: 'MAJOR', }; -const DATE_FORMAT_EDIT = 'DD/MM/YY hh:mm'; +const DATE_FORMAT_EDIT = 'd/m/y H:i'; const DATE_FORMAT_DAY = 'MMM DD'; const DATE_FORMAT_HOURS = 'hh:mm'; diff --git a/src/model/waypoint-model.js b/src/model/waypoint-model.js index c92c90e..bbdddf7 100644 --- a/src/model/waypoint-model.js +++ b/src/model/waypoint-model.js @@ -67,7 +67,6 @@ export default class WaypointsModel extends Observable { throw new Error('The point doesn\'t exist!'); } - try { const response = await this.#waypointsService.updateEvent(update); const adaptedWaypoint = this.#adapter(response); diff --git a/src/presenter/new-waypoint-presenter.js b/src/presenter/new-waypoint-presenter.js index 43ad0d3..052ecda 100644 --- a/src/presenter/new-waypoint-presenter.js +++ b/src/presenter/new-waypoint-presenter.js @@ -31,7 +31,7 @@ export default class NewWaypointPresenter { this.#newWaypointComponent = new EditingFormView({ offers: this.#offers, destinations: this.#destinations, - waypoint: {type: 'flight', destination: '', basePrice: 0, offers: []}, + waypoint: {type: 'flight', destination: '', basePrice: 0, offers: [], isFavorite: false}, onFormSubmit: (newWaypoint) => this.#handleSaveClick(newWaypoint), onClose: () => this.#handleCancelClick(), onDelete: this.#handleCancelClick diff --git a/src/utils.js b/src/utils.js index 281142a..fb20f1e 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,23 +1,10 @@ import dayjs from 'dayjs'; import {FILTER_TYPE, SORTING_TYPES} from './const'; -function getRandomArrayElement(items) { - return items[Math.floor(Math.random() * items.length)]; -} - -function getRandomArrayElements(items, n) { - const shuffled = items.sort(() => 0.5 - Math.random()); - return shuffled.slice(0, n).sort(); -} - function humanizeWaypointDueDate(dueDate, format) { return dueDate ? dayjs(dueDate).format(format) : ''; } -function getRandomInt(max) { - return Math.floor(Math.random() * max); -} - function countDuration(dateFrom, dateTo) { return dayjs(dateTo).diff(dateFrom, 'm'); } @@ -85,10 +72,7 @@ const sorts = { export { - getRandomArrayElement, - getRandomArrayElements, humanizeWaypointDueDate, - getRandomInt, countDuration, formatDuration, stringToDate, diff --git a/src/view/editing-form-view.js b/src/view/editing-form-view.js index af8025d..cadffe7 100644 --- a/src/view/editing-form-view.js +++ b/src/view/editing-form-view.js @@ -1,12 +1,14 @@ -import {humanizeWaypointDueDate, stringToDate} from '../utils.js'; +import {humanizeWaypointDueDate} from '../utils.js'; import {ACTIONS, DATE_FORMAT_EDIT} from '../const.js'; import AbstractStatefulView from '../framework/view/abstract-stateful-view'; -import dayjs from 'dayjs'; +import 'flatpickr/dist/flatpickr.min.css'; +import flatpickr from 'flatpickr'; +import he from 'he'; function getEventOffer({id, title, price, isChecked}) { return `
- +