Skip to content

Commit f9a6985

Browse files
authored
Fixed save file date not displaying properly
E.g. on the 25th of May 2017, at 2:13 pm the last modified time showed as "2017-04-25 2:13:00" Wrong month (off by one, due to JavaScript Month weirdness) and no am/pm marker (for simplicity switched to military time).
1 parent 9bd2b61 commit f9a6985

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

ui/App/components/Saves/Save.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import React from 'react';
22

33
class Save extends React.Component {
4-
hours12(date) { return (date.getHours() + 24) % 12 || 12; }
5-
64
render() {
75
let saveLocation = "/api/saves/dl/" + this.props.save.name
86
let saveSize = parseFloat(this.props.save.size / 1024 / 1024).toFixed(3)
97
let saveLastMod = Date.parse(this.props.save.last_mod);
108
let date = new Date(saveLastMod)
11-
let dateFmt = date.getFullYear() + '-' + date.getMonth() + '-' + date.getDate() + ' '
12-
+ this.hours12(date) + ':' + date.getMinutes() + ':' + date.getSeconds();
9+
let dateFmt = date.toISOString().replace('T', ' ').split('.')[0]; //Outputs date as "YYYY-MM-DD HH:MM:SS" with zero-padding and 24h
1310

1411
return(
1512
<tr>

0 commit comments

Comments
 (0)