Display times in local timezone

This commit is contained in:
Tanner Collin 2020-01-16 02:03:23 +00:00
parent df0d83983d
commit a58aa22bbf
3 changed files with 6 additions and 7 deletions

View File

@ -30,10 +30,10 @@ function ClassTable(props) {
<Table.Cell>{x.course_name}</Table.Cell> <Table.Cell>{x.course_name}</Table.Cell>
<Table.Cell> <Table.Cell>
<Link to={'/classes/'+x.id}> <Link to={'/classes/'+x.id}>
{moment.utc(x.datetime).format('ll')} {moment.utc(x.datetime).local().format('ll')}
</Link> </Link>
</Table.Cell> </Table.Cell>
<Table.Cell>{x.is_cancelled ? 'Cancelled' : moment.utc(x.datetime).format('LT')}</Table.Cell> <Table.Cell>{x.is_cancelled ? 'Cancelled' : moment.utc(x.datetime).local().format('LT')}</Table.Cell>
<Table.Cell>{x.instructor_name}</Table.Cell> <Table.Cell>{x.instructor_name}</Table.Cell>
<Table.Cell>{x.cost === '0.00' ? 'Free' : '$'+x.cost}</Table.Cell> <Table.Cell>{x.cost === '0.00' ? 'Free' : '$'+x.cost}</Table.Cell>
<Table.Cell>{x.student_count}</Table.Cell> <Table.Cell>{x.student_count}</Table.Cell>
@ -125,13 +125,13 @@ export function ClassDetail(props) {
<Table.Row> <Table.Row>
<Table.Cell>Date:</Table.Cell> <Table.Cell>Date:</Table.Cell>
<Table.Cell> <Table.Cell>
{moment.utc(clazz.datetime).format('ll')} {moment.utc(clazz.datetime).local().format('ll')}
</Table.Cell> </Table.Cell>
</Table.Row> </Table.Row>
<Table.Row> <Table.Row>
<Table.Cell>Time:</Table.Cell> <Table.Cell>Time:</Table.Cell>
<Table.Cell> <Table.Cell>
{clazz.is_cancelled ? 'Cancelled' : moment.utc(clazz.datetime).format('LT')} {clazz.is_cancelled ? 'Cancelled' : moment.utc(clazz.datetime).local().format('LT')}
</Table.Cell> </Table.Cell>
</Table.Row> </Table.Row>
<Table.Row> <Table.Row>

View File

@ -119,10 +119,10 @@ export function CourseDetail(props) {
<Table.Row key={i}> <Table.Row key={i}>
<Table.Cell> <Table.Cell>
<Link to={'/classes/'+x.id}> <Link to={'/classes/'+x.id}>
{moment.utc(x.datetime).format('ll')} {moment.utc(x.datetime).local().format('ll')}
</Link> </Link>
</Table.Cell> </Table.Cell>
<Table.Cell>{x.is_cancelled ? 'Cancelled' : moment.utc(x.datetime).format('LT')}</Table.Cell> <Table.Cell>{x.is_cancelled ? 'Cancelled' : moment.utc(x.datetime).local().format('LT')}</Table.Cell>
<Table.Cell>{x.instructor_name}</Table.Cell> <Table.Cell>{x.instructor_name}</Table.Cell>
<Table.Cell>{x.cost === '0.00' ? 'Free' : '$'+x.cost}</Table.Cell> <Table.Cell>{x.cost === '0.00' ? 'Free' : '$'+x.cost}</Table.Cell>
</Table.Row> </Table.Row>

View File

@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react';
import { BrowserRouter as Router, Switch, Route, Link, useParams } from 'react-router-dom'; import { BrowserRouter as Router, Switch, Route, Link, useParams } from 'react-router-dom';
import './light.css'; import './light.css';
import { Button, Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Input, Item, Menu, Message, Segment, Table } from 'semantic-ui-react'; import { Button, Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Input, Item, Menu, Message, Segment, Table } from 'semantic-ui-react';
import moment from 'moment';
import { isAdmin, BasicTable, staticUrl, requester } from './utils.js'; import { isAdmin, BasicTable, staticUrl, requester } from './utils.js';
import { NotFound, PleaseLogin } from './Misc.js'; import { NotFound, PleaseLogin } from './Misc.js';
import { AdminMemberInfo, AdminMemberForm, AdminMemberCards } from './Admin.js'; import { AdminMemberInfo, AdminMemberForm, AdminMemberCards } from './Admin.js';