mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
- replace date-fns by momentJS
- install ng2-chart along with chart.js
This commit is contained in:
parent
dedc70a0a6
commit
91be2a3048
43
README.md
43
README.md
@ -1,26 +1,27 @@
|
||||
## LIBRARIES USED
|
||||
|
||||
| status | lib name | usage |
|
||||
| ------- | -------------------------------------------------------------- | -------------------------------------- |
|
||||
| | [axios](https://github.com/axios/axios) | http client |
|
||||
| | [bulma](https://bulma.io/) | CSS framework |
|
||||
| | [chart.js](https://www.chartjs.org/) | Display graphs. (Commes with MomentJS) |
|
||||
| | [compodoc](https://compodoc.app/) | Generate technic documentation |
|
||||
| | [date-fns](https://date-fns.org) | manipulate dates |
|
||||
| | ESlint, Prettier, Lint-staged | Format & lint code |
|
||||
| | [fork-awesome](https://forkaweso.me) | Icons collection |
|
||||
| | [fullcalendar](https://fullcalendar.io/docs/initialize-es6) | Manage & display calendars |
|
||||
| | [husky](https://www.npmjs.com/package/husky) | Hook actions on commit |
|
||||
| | [jest](https://jestjs.io/) | test engine |
|
||||
| removed | [locale-enum](https://www.npmjs.com/package/locale-enum) | enum of all locales |
|
||||
| | [ngx-clipboard](https://www.npmjs.com/package/ngx-clipboard) | Handle clipboard |
|
||||
| | [ngx-markdown](https://www.npmjs.com/package/ngx-markdown) | markdown parser |
|
||||
| | [ngx-webstorage](https://www.npmjs.com/package/ngx-webstorage) | handle localStorage & webStorage |
|
||||
| | [primeNG](https://www.primefaces.org/primeng/) | UI components collection |
|
||||
| | [quill](https://www.npmjs.com/package/quill) | powerful rich text editor. WYSIWYG. |
|
||||
| removed | [storybook](https://storybook.js.org/) | StyleGuide UI |
|
||||
| | [ts-mockito](https://www.npmjs.com/package/ts-mockito) | Mocks for testing. |
|
||||
| | [uuid](https://www.npmjs.com/package/uuid) | handle client-side generation of uuids |
|
||||
| status | lib name | usage |
|
||||
| --------------- | -------------------------------------------------------------- | ---------------------------------------- |
|
||||
| | [axios](https://github.com/axios/axios) | http client |
|
||||
| | [bulma](https://bulma.io/) | CSS framework |
|
||||
| | [chart.js](https://www.chartjs.org/) | Display graphs. (Comes with MomentJS) |
|
||||
| | [compodoc](https://compodoc.app/) | Generate technic documentation |
|
||||
| | ESlint, Prettier, Lint-staged | Format & lint code |
|
||||
| | [fork-awesome](https://forkaweso.me) | Icons collection |
|
||||
| | [fullcalendar](https://fullcalendar.io/docs/initialize-es6) | Manage & display calendars |
|
||||
| | [husky](https://www.npmjs.com/package/husky) | Hook actions on commit |
|
||||
| | [jest](https://jestjs.io/) | test engine |
|
||||
| removed | [locale-enum](https://www.npmjs.com/package/locale-enum) | enum of all locales |
|
||||
| | [momentJS](https://momentjs.com/) | manipulate dates. (chartJS’s dependency) |
|
||||
| to be installed | [ng2-charts](https://valor-software.com/ng2-charts/) | Manipulate graphs along with chart.js |
|
||||
| | [ngx-clipboard](https://www.npmjs.com/package/ngx-clipboard) | Handle clipboard |
|
||||
| | [ngx-markdown](https://www.npmjs.com/package/ngx-markdown) | markdown parser |
|
||||
| | [ngx-webstorage](https://www.npmjs.com/package/ngx-webstorage) | handle localStorage & webStorage |
|
||||
| | [primeNG](https://www.primefaces.org/primeng/) | UI components collection |
|
||||
| | [quill](https://www.npmjs.com/package/quill) | powerful rich text editor. WYSIWYG. |
|
||||
| removed | [storybook](https://storybook.js.org/) | StyleGuide UI |
|
||||
| | [ts-mockito](https://www.npmjs.com/package/ts-mockito) | Mocks for testing. |
|
||||
| | [uuid](https://www.npmjs.com/package/uuid) | handle client-side generation of uuids |
|
||||
|
||||
---
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
"src/styles.scss"
|
||||
],
|
||||
"scripts": [
|
||||
"node_modules/chart.js/dist/Chart.min.js",
|
||||
"node_modules/marked/lib/marked.js",
|
||||
"node_modules/prismjs/prism.js",
|
||||
"node_modules/prismjs/components/prism-css.min.js"
|
||||
|
@ -36,8 +36,8 @@
|
||||
"axios": "^0.19.2",
|
||||
"bulma": "^0.8.2",
|
||||
"chart.js": "^2.9.3",
|
||||
"date-fns": "^2.12.0",
|
||||
"fork-awesome": "^1.1.7",
|
||||
"ng2-charts": "^2.3.0",
|
||||
"ngx-clipboard": "^13.0.0",
|
||||
"ngx-markdown": "^9.0.0",
|
||||
"ngx-webstorage": "^5.0.0",
|
||||
@ -78,7 +78,7 @@
|
||||
"protractor": "~5.4.3",
|
||||
"ts-jest": "^25.4.0",
|
||||
"ts-mockito": "^2.5.0",
|
||||
"ts-node": "~8.9.0",
|
||||
"ts-node": "^8.10.1",
|
||||
"typescript": "~3.8.3"
|
||||
},
|
||||
"husky": {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { isValid } from 'date-fns';
|
||||
import * as moment from 'moment';
|
||||
|
||||
export class PollOption {
|
||||
constructor(public label: string, public url?: string, public subOptions?: PollOption[]) {}
|
||||
|
||||
public isDatePoll(): boolean {
|
||||
return isValid(this.label);
|
||||
return moment(this.label).isValid();
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { addDays, differenceInDays, format } from 'date-fns';
|
||||
import * as moment from 'moment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DateUtilsService {
|
||||
public static addDaysToDate(days: number, date: Date): Date {
|
||||
return addDays(date, days);
|
||||
return moment(date).add(days, 'days').toDate();
|
||||
}
|
||||
|
||||
public static diffInDays(dateLeft: Date, dateRight: Date): number {
|
||||
return differenceInDays(dateLeft, dateRight);
|
||||
return moment(dateLeft).diff(moment(dateRight));
|
||||
}
|
||||
|
||||
public static formatDate(date): string {
|
||||
return format(date, 'yyyy-MM-dd');
|
||||
return moment(date).format('yyyy-MM-dd');
|
||||
}
|
||||
|
||||
public static orderDates(): Date[] {
|
||||
|
@ -1,12 +1,11 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { AdminComponent } from './pages/admin/admin.component';
|
||||
import { AnswersComponent } from './pages/answers/answers.component';
|
||||
import { CreateOrRetrieveComponent } from './pages/create-or-retrieve/create-or-retrieve.component';
|
||||
import { DatesComponent } from './pages/dates/dates.component';
|
||||
import { EndConfirmationComponent } from './pages/end-confirmation/end-confirmation.component';
|
||||
import { BaseComponent } from './pages/example/base-page/base.component';
|
||||
import { KindComponent } from './pages/example/kind/kind.component';
|
||||
import { PicturesComponent } from './pages/example/pictures/pictures.component';
|
||||
import { HomeComponent } from './pages/home/home.component';
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ChartsModule } from 'ng2-charts';
|
||||
import {
|
||||
ConfirmDialogModule,
|
||||
DialogModule,
|
||||
@ -21,6 +22,7 @@ import { PollPageComponent } from './components/poll-page/poll-page.component';
|
||||
declarations: [PageNotFoundComponent, PollPageComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
ChartsModule,
|
||||
ConfirmDialogModule,
|
||||
DialogModule,
|
||||
InputSwitchModule,
|
||||
@ -33,6 +35,7 @@ import { PollPageComponent } from './components/poll-page/poll-page.component';
|
||||
],
|
||||
exports: [
|
||||
TranslateModule,
|
||||
ChartsModule,
|
||||
ConfirmDialogModule,
|
||||
DialogModule,
|
||||
InputSwitchModule,
|
||||
|
29
yarn.lock
29
yarn.lock
@ -1530,6 +1530,13 @@
|
||||
dependencies:
|
||||
"@babel/types" "^7.3.0"
|
||||
|
||||
"@types/chart.js@^2.7.48":
|
||||
version "2.9.20"
|
||||
resolved "https://registry.yarnpkg.com/@types/chart.js/-/chart.js-2.9.20.tgz#db503fc0d478d1d2a99eb0099d5c2b9c77599931"
|
||||
integrity sha512-Xv4dd+DYqtTdUWbDIwaDEFtUIFwoQN44wiDDrWXdJtfGtOFlFIxXrsu8D+XJCS9o7mZbW29X8vPptwVrduz4JA==
|
||||
dependencies:
|
||||
moment "^2.10.2"
|
||||
|
||||
"@types/color-name@^1.1.1":
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
|
||||
@ -3765,11 +3772,6 @@ data-urls@^2.0.0:
|
||||
whatwg-mimetype "^2.3.0"
|
||||
whatwg-url "^8.0.0"
|
||||
|
||||
date-fns@^2.12.0:
|
||||
version "2.12.0"
|
||||
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.12.0.tgz#01754c8a2f3368fc1119cf4625c3dad8c1845ee6"
|
||||
integrity sha512-qJgn99xxKnFgB1qL4jpxU7Q2t0LOn1p8KMIveef3UZD7kqjT3tpFNNdXJelEHhE+rUgffriXriw/sOSU+cS1Hw==
|
||||
|
||||
debug@2.6.9, debug@^2.2.0, debug@^2.3.3:
|
||||
version "2.6.9"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||
@ -7671,6 +7673,15 @@ next-tick@~1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"
|
||||
integrity sha1-yobR/ogoFpsBICCOPchCS524NCw=
|
||||
|
||||
ng2-charts@^2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/ng2-charts/-/ng2-charts-2.3.0.tgz#e4dd1f7fe12dc2635d5e8c4f101a8d4c4f433754"
|
||||
integrity sha512-D5K7OqF0m5lOBYvNOsraoEo4OPHja9zfGNj+HWy2nUcP0LP2s+Y/QaQlkG/1rHlwXq9HPm8rLxzSutA0eLHxGQ==
|
||||
dependencies:
|
||||
"@types/chart.js" "^2.7.48"
|
||||
lodash "^4.17.11"
|
||||
tslib "^1.9.0"
|
||||
|
||||
ngx-clipboard@^13.0.0:
|
||||
version "13.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ngx-clipboard/-/ngx-clipboard-13.0.0.tgz#cbfc25b0fa5fbaaa76ee1229ebc7a6ed2ef0318b"
|
||||
@ -10931,10 +10942,10 @@ ts-mockito@^2.5.0:
|
||||
dependencies:
|
||||
lodash "^4.17.5"
|
||||
|
||||
ts-node@~8.9.0:
|
||||
version "8.9.1"
|
||||
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.9.1.tgz#2f857f46c47e91dcd28a14e052482eb14cfd65a5"
|
||||
integrity sha512-yrq6ODsxEFTLz0R3BX2myf0WBCSQh9A+py8PBo1dCzWIOcvisbyH6akNKqDHMgXePF2kir5mm5JXJTH3OUJYOQ==
|
||||
ts-node@^8.10.1:
|
||||
version "8.10.1"
|
||||
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.10.1.tgz#77da0366ff8afbe733596361d2df9a60fc9c9bd3"
|
||||
integrity sha512-bdNz1L4ekHiJul6SHtZWs1ujEKERJnHs4HxN7rjTyyVOFf3HaJ6sLqe6aPG62XTzAB/63pKRh5jTSWL0D7bsvw==
|
||||
dependencies:
|
||||
arg "^4.1.0"
|
||||
diff "^4.0.1"
|
||||
|
Loading…
Reference in New Issue
Block a user