Just a quick question to re-open this if I may…
I spotted that when this was being used the time stamp was quite long, looking at the various options using JavaScript to shorten the date it seemed incredibly complex, from what I could tell the desired output would always be 21 characters long so went with a bit of a hacky way of doing this…
<script type="text/discourse-plugin" version="0.4">
api.onToolbarCreate(toolbar => {
toolbar.addButton({
id: "updated_button",
group: "extras",
icon: "clock-o",
perform: e => e.addText("_Updated " + new Date().toString().substring(0,21) + "_")
});
});
</script>
I then spotted that the hover text didn’t display a name correctly - so we have added this
title: "Updated Timestamp",
thus;
<script type="text/discourse-plugin" version="0.4">
api.onToolbarCreate(toolbar => {
toolbar.addButton({
id: "updated_button",
group: "extras",
icon: "clock-o",
title: "Updated Timestamp",
perform: e => e.addText("_Updated " + new Date().toString().substring(0,21) + "_")
});
});
</script>
but the output in the hover text appears as [en.Updated Timestamp]
Anyway to remove the square brackets and the en. part?