mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2026-03-05 16:48:51 +00:00
Check created time to be valid and discard milliseconds from date objects
This commit is contained in:
@@ -100,17 +100,20 @@ export default {
|
||||
|
||||
readDate: function (bytes) {
|
||||
const n = this.readNumber(bytes);
|
||||
const d = new Date();
|
||||
d.setTime(n * 1000);
|
||||
const d = new Date(n * 1000);
|
||||
return d;
|
||||
},
|
||||
|
||||
writeDate: function (time) {
|
||||
const numeric = Math.round(time.getTime() / 1000);
|
||||
const numeric = Math.floor(time.getTime() / 1000);
|
||||
|
||||
return this.writeNumber(numeric, 4);
|
||||
},
|
||||
|
||||
normalizeDate: function (time = Date.now()) {
|
||||
return time === null ? time : new Date(Math.floor(+time / 1000) * 1000);
|
||||
},
|
||||
|
||||
hexdump: function (str) {
|
||||
const r = [];
|
||||
const e = str.length;
|
||||
|
||||
Reference in New Issue
Block a user