Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Relative date" to be offered as a Formatting option for date columns in Reports #22371

Closed
miyamotoh opened this issue Feb 21, 2023 · 7 comments · Fixed by #22426
Closed

"Relative date" to be offered as a Formatting option for date columns in Reports #22371

miyamotoh opened this issue Feb 21, 2023 · 7 comments · Fixed by #22426
Assignees
Projects
Milestone

Comments

@miyamotoh
Copy link
Contributor

In the Formatting tab of a Report, when you have a date column, you'll have the following formatting options;
image
Basically just how date/time elements (ie. Y, M, D, H, M, S, Z) are shown/arranged. However, in some cases, "relative date" (eg. "days since") is desired rather than a raw date value, no matter how it's formatted.

@Fryguy
Copy link
Member

Fryguy commented Mar 1, 2023

@MelsHyrule I wonder if one of the new UI people can work on this one since it's small and self-contained. WDYT?

@MelsHyrule MelsHyrule removed their assignment Mar 21, 2023
@MelsHyrule
Copy link
Member

@miq-bot assign @MelsHyrule

@mahantidinesh7
Copy link
Contributor

@Fryguy we need to have one more option with Days since and that should display the number of days that were passed on till now from the mentioned date in the report . Am i correct ??

@Fryguy
Copy link
Member

Fryguy commented Mar 23, 2023

Days since implies a starting point (i..e Days since what), but the data doesn't have that ability. Instead, I said "relative date" as I'd expect the type of output you would see from ActionView::Helpers::DateHelper.time_ago_in_words (e.g. 1 minute ago, 3 hours ago)

@kbrock
Copy link
Member

kbrock commented Mar 24, 2023

I thought we could tap into those view helpers. Do you remember if we still have this?

tapping into the module without requiring creating a new helper e.g.:

date_helper = Class.new { include ActionView::Helpers::DateHelper }.new

@Fryguy
Copy link
Member

Fryguy commented Mar 24, 2023

Yes, that's exactly how we would do it. You can also do helper = Module.new { extend ActionView::Helpers::DateHelper }, which might be a little lighter:

[1] pry(main)> require "action_view"
[2] pry(main)> helper = Module.new { extend ActionView::Helpers::DateHelper }
[3] pry(main)> ls helper
ActionView::Helpers::DateHelper#methods:
  date_select      distance_of_time_in_words         select_date      select_day   select_minute  select_second  select_year        time_select
  datetime_select  distance_of_time_in_words_to_now  select_datetime  select_hour  select_month   select_time    time_ago_in_words  time_tag
[4] pry(main)> helper.time_ago_in_words(Time.now + 6000)
=> "about 2 hours"

@Fryguy Fryguy assigned mahantidinesh7 and unassigned MelsHyrule Mar 24, 2023
@Fryguy Fryguy added this to In progress in Roadmap Mar 24, 2023
@Fryguy Fryguy added this to the Petrosian milestone Mar 24, 2023
@kbrock
Copy link
Member

kbrock commented Mar 24, 2023

cross posting. We have ApplicationController.helpers that has all those mixed in.
Not sure how expensive it is to reference that memory wise. It may be instantiated no matter what.

@Fryguy Fryguy moved this from In progress to Petrosian in Roadmap Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Roadmap
  
Petrosian
Development

Successfully merging a pull request may close this issue.

5 participants