Skip to content

Commit

Permalink
fix(timeStamps): Display local TimeStamps
Browse files Browse the repository at this point in the history
  • Loading branch information
manavbp authored and joshuef committed Jun 24, 2019
1 parent 36b5e9c commit 0aee7e6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
19 changes: 5 additions & 14 deletions app/components/PerusePages/History/History.tsx
@@ -1,4 +1,5 @@
import React, { Component } from 'react';
import moment from 'moment';
import { remote } from 'electron';
import { parse } from 'url';
import _ from 'lodash';
Expand Down Expand Up @@ -63,17 +64,10 @@ export class History extends Component<HistoryProps, {}> {
parsedList.push( dateHeader );
list.forEach( ( item ) => {
const timeStamp = new Date( item.timeStamp );
let Hours = timeStamp.getUTCHours();
Hours = `0${Hours}`.slice( -2 );
const checkAmOrPm = `0${Hours}`.slice( -2 );
if ( Hours > 12 ) {
Hours = parseInt( Hours, 10 );
Hours -= 12;
}
let Mins = timeStamp.getUTCMinutes();
Mins = `0${Mins}`.slice( -2 );
const amOrPm = checkAmOrPm <= 12 ? 'AM' : 'PM';
const newTimeStamp = `${Hours}:${Mins}\t${amOrPm}`;
const newTimeStamp = moment
.utc( timeStamp )
.local()
.format( 'LT' );
const handleClick = ( event ) => {
// required to prevent the app navigating by default.
event.preventDefault();
Expand Down Expand Up @@ -119,9 +113,6 @@ export class History extends Component<HistoryProps, {}> {
<H1 title="History" />
</PageHeader>
</Page>
<h6 className={`${styles.warning}`}>
*Note: Time displayed is in GMT format
</h6>
<Table className={styles.table}>
{parsedList}
{!parsedList.length && (
Expand Down
6 changes: 0 additions & 6 deletions app/components/PerusePages/History/history.css
Expand Up @@ -15,12 +15,6 @@
min-height: auto; /* override nessie 100vh */
}

.warning {
text-align: right;
padding-right: 10px;
color: #a9a9a9;
}

.tab {
/* stylelint-disable-next-line property-no-unknown */
composes: tab from '../../Tab/tab.css';
Expand Down
6 changes: 5 additions & 1 deletion package.json
Expand Up @@ -149,7 +149,10 @@
"target": "dir"
},
"linux": {
"target": ["dir", "AppImage"]
"target": [
"dir",
"AppImage"
]
},
"mac": {
"target": "dir"
Expand Down Expand Up @@ -354,6 +357,7 @@
"i18n": "0.8.3",
"jest-tobetype": "git+https://github.com/joshuef/jest-tobetype.git#master",
"lodash": ">=4.17.11",
"moment": "^2.24.0",
"nessie-ui": "7.0.4",
"open": "^6.3.0",
"react": "^16.6.3",
Expand Down

0 comments on commit 0aee7e6

Please sign in to comment.