Inserting Date/Time in "About Me"

AI-generated summary

The discussion revolves around the issue of inserting date/time in the “About Me” section of a user’s profile. wadestriebel reports that date/time input gets formatted as datetime, not the expected date and time format.

codinghorror and sam indicate that the full post decoration is not supported in the “About Me” section. However, sam suggests that adding support for date picker in this section might be feasible.

joffreyjaffeux explores the possibility of making it work but highlights the potential risks and complications, including the truncation of dates and removal of HTML. He proposes an alternative solution of removing the toolbar button from the about composer.

codinghorror agrees with this approach, and joffreyjaffeux implements the change by removing the button in a GitHub commit.

When inserting a date/time in the About Me section it gets formatted as datetime, not the expected date and time format.

Inserting Date/Time

Public Profile

Discourse Information:

4 Likes

I don’t think this kind of date formatting is supported in About Me.

7 Likes

Yeah I don’t think we run the full post decoration in the about me section (nor should we), that said I think it would not be too much of a stretch to add support for the date picker there especially since we show it in the toolbar.

@j.jaffeux thoughts?

9 Likes

So I can make it work quite easily:

But it has a price that I don’t think we are willing to pay:

  • currently in bio we render “bio_excerpt” and not just “bio_cooked”, which could mean the date might be truncated and also that we are removing HTML:
[1] pry(main)> PrettyText.excerpt("<b>Foo</b>", 5)
=> "Foo"
  • Also we are rendering this as text and using {{text-overflow}} component

So to make it work without going crazy and building some kind of postCooked hook this is not possible without changing:

<div class='bio'>{{text-overflow class="overflow" text=user.bio_excerpt}}</div>

to

<div class='bio'>{{{user.bio_cooked}}}</div>

Which I don’t think we want to do for such a specific edge case, it basically means we are rendering HTML from a user input. Your call, let me know if you want to dig this more or explore other solutions.

Might be safer to just remove toolbar button from about composer ?

10 Likes

Yes remove that button please.

8 Likes

Done in:

https://github.com/discourse/discourse/commit/e303b4d1818422863ac8cc17b34dd65186f50989

5 Likes