FIX: handle german quotes in discourse local-dates (#8386)
https://meta.discourse.org/t/insert-date-timezone-is-always-utc-my-timezone-is-ignored/126307
This commit is contained in:
parent
026832fb80
commit
3d1b6b6729
|
@ -13,10 +13,12 @@ function addLocalDate(buffer, matches, state) {
|
||||||
countdown: null
|
countdown: null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const matchString = matches[1].replace(/„|“/g, '"');
|
||||||
|
|
||||||
let parsed = parseBBCodeTag(
|
let parsed = parseBBCodeTag(
|
||||||
"[date date" + matches[1] + "]",
|
"[date date" + matchString + "]",
|
||||||
0,
|
0,
|
||||||
matches[1].length + 11
|
matchString.length + 11
|
||||||
);
|
);
|
||||||
|
|
||||||
config.date = parsed.attrs.date;
|
config.date = parsed.attrs.date;
|
||||||
|
|
|
@ -80,4 +80,13 @@ describe PrettyText do
|
||||||
expect(excerpt).to eq("Wednesday, October 16, 2019 6:00 PM (UTC)")
|
expect(excerpt).to eq("Wednesday, October 16, 2019 6:00 PM (UTC)")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'german quotes' do
|
||||||
|
let(:post) { Fabricate(:post, raw: '[date=2019-10-16 time=14:00:00 format="LLLL" timezone=„America/New_York“]') }
|
||||||
|
|
||||||
|
it 'converts german quotes to regular quotes' do
|
||||||
|
excerpt = PrettyText.excerpt(post.cooked, 200)
|
||||||
|
expect(excerpt).to eq('Wednesday, October 16, 2019 6:00 PM (UTC)')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue