mirror of
https://github.com/writeas/writefreely
synced 2025-01-05 20:47:30 +01:00
Merge pull request #241 from writeas/post-time-fix
fixes imported post times
This commit is contained in:
commit
6d3803bfe8
@ -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…
Reference in New Issue
Block a user