Merge pull request #241 from writeas/post-time-fix
fixes imported post times
This commit is contained in:
commit
6d3803bfe8
1 changed files with 4 additions and 1 deletions
|
@ -42,13 +42,16 @@
|
|||
</select>
|
||||
</label>
|
||||
<script>
|
||||
// timezone offset in seconds
|
||||
const tzOffsetSec = new Date().getTimezoneOffset() * 60;
|
||||
const fileInput = document.getElementById('fileInput');
|
||||
const fileDates = document.getElementById('fileDates');
|
||||
fileInput.addEventListener('change', (e) => {
|
||||
const files = e.target.files;
|
||||
let dateMap = {};
|
||||
for (let file of files) {
|
||||
dateMap[file.name] = file.lastModified / 1000;
|
||||
// convert from milliseconds to seconds and adjust for tz
|
||||
dateMap[file.name] = Math.round(file.lastModified / 1000) + tzOffsetSec;
|
||||
}
|
||||
fileDates.value = JSON.stringify(dateMap);
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue