Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

DateFormatter

Convenience methods for formatting date and time. More...

Import Statement: import Felgo 3.0
Inherits:

QtObject

Methods

Detailed Description

This singleton component offers helper methods for formatting date and time values in human-readable pretty formats.

Method Documentation

prettyDateTime(date)

Returns a human-readable date and time format from the given date parameter (JavaScript Date type) in a relative way, following these rules:

  • If date is within the last or the next 60 seconds, it returns a localized "just now" string
  • If date is within the last or next hour, it returns a string in the format "<x>m" where <x> is the amount of minutes since date
  • If date is within the last or next day, it returns a string in the format "<x>h" where <x> is the amount of hours since date
  • If date is within the last or next week, it returns a string in the format "<x>d" where <x> is the amount of days since date
  • If date is within the last or next month, it returns a string in the format "<x>w" where <x> is the amount of weeks since date
  • For all other date values it returns a localized date/time string in the Locale.ShortFormat format

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded