mirror of https://github.com/gorhill/uBlock.git
Fix bad date computation in auto-comment feature
Related feedback: https://old.reddit.com/r/uBlockOrigin/comments/1bxz6oi/
This commit is contained in:
parent
846c6462c3
commit
a5f6c35bb0
|
@ -605,14 +605,10 @@ onBroadcast(msg => {
|
||||||
this.hiddenSettings.autoCommentFilterTemplate.indexOf('{{') !== -1
|
this.hiddenSettings.autoCommentFilterTemplate.indexOf('{{') !== -1
|
||||||
) {
|
) {
|
||||||
const d = new Date();
|
const d = new Date();
|
||||||
// Date in YYYY-MM-DD format - https://stackoverflow.com/a/50130338
|
|
||||||
const ISO8601Date = new Date(d.getTime() +
|
|
||||||
(d.getTimezoneOffset()*60000)).toISOString().split('T')[0];
|
|
||||||
const url = new URL(options.docURL);
|
const url = new URL(options.docURL);
|
||||||
comment =
|
comment = '! ' +
|
||||||
'! ' +
|
|
||||||
this.hiddenSettings.autoCommentFilterTemplate
|
this.hiddenSettings.autoCommentFilterTemplate
|
||||||
.replace('{{date}}', ISO8601Date)
|
.replace('{{date}}', d.toLocaleDateString(undefined, { dateStyle: 'medium' }))
|
||||||
.replace('{{time}}', d.toLocaleTimeString())
|
.replace('{{time}}', d.toLocaleTimeString())
|
||||||
.replace('{{hostname}}', url.hostname)
|
.replace('{{hostname}}', url.hostname)
|
||||||
.replace('{{origin}}', url.origin)
|
.replace('{{origin}}', url.origin)
|
||||||
|
|
Loading…
Reference in New Issue