Human readable date/time columns

Human readable date/time columns

mleppalamleppala Posts: 8Questions: 2Answers: 0

I would think that this plug in being that it deals with the presentation of data tables that it should have an option to provide the date/time column(s) that would be converted into human readable date/time. Options for displaying could be a single time or multiple times .

Single time:

  • one second ago
  • 30 minutes ago
  • 1 hour ago
  • More than 3 hours ago
  • 2 days ago
  • More than 2 days ago
  • 3 months ago
  • More than 3 months ago
  • 1 year ago
  • More than 1 year ago

Multiple times:
Time (HM):

  • 1 hour 34 minutes ago

Time (HMS):

  • 1 hour, 34 minutes and 30 seconds ago

Dates (YM):

  • 1 year and 3 months ago
  • Over 1 year and 3 months ago

Date(YMD)

  • 1 year, 3 months and 12 days ago

DateTime will just be the combination of the Date and times.

  • 1 year, 3 months, 12 days, 1 hour and 34 minutes
  • 1 year, 3 months, 12 days, 1 hour, 34 minutes and 30 seconds ago

This would need to be filtered with items like:

  • today
  • in the last week
  • in the last 2 weeks
  • in the last month
  • in the last 3 months
  • in the last 6 months
  • in the last year
  • more than a year ago

This question has an accepted answers - jump to answer

Answers

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    What you are looking for is at http://momentjs.com/ and you can find examples how it is incorporated datatables.

  • mleppalamleppala Posts: 8Questions: 2Answers: 0

    Bindrid,
    Thanks for the reply. I use carbon to do this but I was trying to put his topic into the Feature request but it landed in the section.

  • allanallan Posts: 63,893Questions: 1Answers: 10,531 Site admin
    Answer ✓

    Hi,

    Thanks for the suggestion! Quickly regarding the forum categories - you need to have purchased something to post in anything other than "Free community support". I had thought the forum would filter the category list - but apparently not. I'll look into that!

    Its a good suggestion. I think a mashup between your own and @bindrid's would be appropriate here. MomentJS is superb and there is no way I want to extend DataTables functionality to include such date / time parsing itself - there is no need - Moment already does it for us!

    A rendering plug-in that utilises Moment would be the way to do this. In fact, now that I write this, I recall that I actually wrote one not too long ago. Been meaning to write a blog post about it, but haven't yet.

    Allan

This discussion has been closed.