diff --git a/package-lock.json b/package-lock.json index 7140d26..60789b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5879,13 +5879,11 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -5898,18 +5896,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -6012,8 +6007,7 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -6023,7 +6017,6 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6036,20 +6029,17 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true, - "optional": true + "bundled": true }, "minipass": { "version": "2.2.4", "bundled": true, - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -6066,7 +6056,6 @@ "mkdirp": { "version": "0.5.1", "bundled": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -6139,8 +6128,7 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -6150,7 +6138,6 @@ "once": { "version": "1.4.0", "bundled": true, - "optional": true, "requires": { "wrappy": "1" } @@ -6256,7 +6243,6 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/src/VideoInfo.js b/src/VideoInfo.js index 2d265cc..2af125b 100644 --- a/src/VideoInfo.js +++ b/src/VideoInfo.js @@ -1,6 +1,6 @@ import React from 'react'; import Wikipedia from './areainfo/Wikipedia'; -import { Tabs, Tab, Table } from 'react-bootstrap'; +import { Tabs, Tab } from 'react-bootstrap'; import {Link, withRouter} from 'react-router-dom'; import axios from 'axios'; import Linkify from "react-linkify"; @@ -12,7 +12,6 @@ import './css/VideoInfo.scss'; const ytclear = require('@c0b41/ytclear'); - class VideoInfo extends React.Component { state = { @@ -25,7 +24,7 @@ class VideoInfo extends React.Component { }; momentDuration(duration) { - return moment.duration(duration).format('hh:mm:ss'); + return moment.duration(duration).format('hh:mm:ss') } ISO_8601parse(a) { @@ -145,8 +144,8 @@ class VideoInfo extends React.Component { render() { const { error, isLoaded, VideoDetails, comments } = this.state; - const momentDuration = this.momentDuration; // bind momentDuration in render to the actual method - const ISO_8601parse = this.ISO_8601parse; // bind momentDuration in render to the actual method + const momentDuration = this.momentDuration; + const ISO_8601parse = this.ISO_8601parse; if (error) { return ( @@ -204,6 +203,9 @@ class VideoInfo extends React.Component { ) })} + + /* Insert code here */ + {this.state.items.map(function (item,index) { @@ -60,9 +67,7 @@ class RecommenderRandom extends Component{ {item.snippet.title}
- {item.snippet.channelTitle} - {item.snippet.publishedAt.replace(/(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+).000Z/,function(match,p1,p2,p3,p4,p5,p6){ - return(p3+'/'+p2+'/'+p1+' at '+p4+':'+p5+':'+p6); //Funzione che trasforma la data e ora di pubblicazione dal formato ISO nel normale formato da cristiani - })} + {item.snippet.channelTitle} - {ISO_8601parse(item.snippet.publishedAt)}
diff --git a/src/reccomenders/Related.js b/src/reccomenders/Related.js index b1c3529..e816eb9 100644 --- a/src/reccomenders/Related.js +++ b/src/reccomenders/Related.js @@ -2,6 +2,8 @@ import React, { Component } from 'react'; import axios from 'axios'; import {Link} from "react-router-dom"; import {Card} from "react-bootstrap"; +import moment from "moment"; + class Related extends Component { constructor(props) { @@ -12,6 +14,9 @@ class Related extends Component { } } + ISO_8601parse(a) { + return moment(a, moment.ISO_8601).format('ddd, DD/MM/YYYY hh:mm:ss'); + } componentWillMount() { if(this.props.match.params.id){ if(this.props.match.params.id === this.state.videoId){} @@ -51,6 +56,7 @@ class Related extends Component { } render() { + const ISO_8601parse = this.ISO_8601parse; return (
{this.state.items.map(function (item,index) { @@ -70,9 +76,8 @@ class Related extends Component { {item.snippet.title}
- {item.snippet.channelTitle} - {item.snippet.publishedAt.replace(/(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+).000Z/,function(match,p1,p2,p3,p4,p5,p6){ - return(p3+'/'+p2+'/'+p1+' at '+p4+':'+p5+':'+p6); //Funzione che trasforma la data e ora di pubblicazione dal formato ISO nel normale formato da cristiani - })} + {item.snippet.channelTitle} - {ISO_8601parse(item.snippet.publishedAt)} +