Skip to content

Website should include start and end dates in formatted name of element #431

Closed
OpenHistoricalMap/ohm-website
#277

Description

@1ec5

Whenever the user browses an element using the main website, the feature’s automatically generated name should include the start and end dates to disambiguate the feature from similarly named features from different time periods. Since a date disambiguator doesn’t appear automatically, mappers sometimes add the date to name, even though the actual name has no dates in it.

Here’s where the start_date and end_date values would be appended to the feature name.

Activity

  1. danrademacher commented on Sep 21, 2022

    @danrademacher

    Thanks for the reference to where we can add this!

    I imagine we should trap for cases when either or both start_date and end_date are not present

  2. 1ec5 commented on Dec 14, 2023

    @1ec5
    MemberAuthor

    As of OpenHistoricalMap/iD#184, iD automatically appends a date range to each feature’s label, which creates an expectation that the name should not include this date range. To the extent that users will need to see the date ranges when browsing elements on the main website, we should mimic that enhancement in ohm-website for consistency.

  3. 1ec5 commented on Jan 27, 2024

    @1ec5
    MemberAuthor

    The active-date-range gem makes it easier to format a date range. It exposes an API similar to Intl.DateTimeFormat.formatRange() in JavaScript. However, it only supports English so far. Maybe for a start, we could just roll our own date range formatter, since we’d only be displaying start and end years as part of this formatted name.

  4. jeffreyameyer commented on May 28, 2024

    @jeffreyameyer
    Member

    @danrademacher - if @1ec5 has already done the work here, can we have someone review it and get this in?

  5. danrademacher commented on May 28, 2024

    @danrademacher

    I see that @1ec5 has very helpfully shown us where we should add the dates:

    Here’s where the start_date and end_date values would be appended to the feature name.

    And checked into options for formatting dates:

    The active-date-range gem makes it easier to format a date range. It exposes an API similar to Intl.DateTimeFormat.formatRange() in JavaScript. However, it only supports English so far. Maybe for a start, we could just roll our own date range formatter, since we’d only be displaying start and end years as part of this formatted name.

    AND Minh did this work to add to the labels in iD (which is awesome!)

    But I don't see that the work on the Rails app is actually done, unless there's a PR I missed.

    I think the need here is:

    1. Modify the browse_helper.rb file to append start_date and end_date probably like (start_date - end_date)
    2. Roll our own date formatter to get the dates to appear properly, ideally with some internationalization (I am surprised Rails doesn't have a date formatter already? How does the app handle things like modification dates?)
  6. 1ec5 commented on May 29, 2024

    @1ec5
    MemberAuthor

    Right, I haven’t made the change. I haven’t set up a development environment to do it yet. Sorry for the confusion.

    How does the app handle things like modification dates?

    We don’t really need to rely on a gem to format dates. The website currently uses the time_ago_in_words function in Rails, plus a custom localizable format string for the tooltip:

    https://github.com/OpenHistoricalMap/ohm-website/blob/ed3ff3c171c5040b76cf4620915d02259a7f89ba/app/helpers/application_helper.rb#L28-L34

    Rails also has a to_fs function that could format a year respecting the user’s language preference. It also allows for a custom formatting function, which we might need to supply depending on how the built-in implementation handles BCE dates. Gems like active-date-range and date_range_formatter exist because there isn’t built-in support for formatting date ranges. We could tie things together with a custom format for date ranges. We’ll have to define a custom localizable string anyways for the NAME [DATE RANGE] format.

  7. 1ec5 commented on Jun 27, 2024

    @1ec5
    MemberAuthor

    In openstreetmap/openstreetmap-website#4033, the upstream maintainers were reluctant to construct element labels from anything other than name and ref for fear of a slippery slope. But given the universality of start_date and end_date in OHM, I don’t see that as a risk in our fork.

  8. 1ec5 commented on Jan 14, 2025

    @1ec5
    MemberAuthor

    Nominatim search results are one of the most prominent places where we’d want to label features, but Nominatim currently isn’t configured to expose the dates in its responses: #949.

  9. 1ec5 commented on Feb 25, 2025

    @1ec5
    MemberAuthor

    Nominatim currently isn’t configured to expose the dates in its responses: #949.

    This is unblocked.

  10. assigned and unassigned on Mar 11, 2025
  11. moved this from Todo - Known Path to In Progress in OpenHistoricalMap Dev Planningon Mar 11, 2025
  12. moved this from In Progress to Ready for staging in OpenHistoricalMap Dev Planningon Mar 14, 2025
  13. added theissue type on Mar 16, 2025
  14. added
    website
    and removed on Mar 17, 2025
  15. moved this from Ready for staging to In Production in OpenHistoricalMap Dev Planningon Mar 26, 2025
  16. moved this from In Production to On Staging in OpenHistoricalMap Dev Planningon Mar 26, 2025
  17. moved this from On Staging to In Production in OpenHistoricalMap Dev Planningon Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

dateswebsite

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions