Jump to content

Guides

ips.utils.time

Description

The time utility provides methods for working with timestamps.

 

Methods

string readable( number timestamp )

Returns the time as an approximate relative string, e.g. 8 hours ago, 2 days ago, Just now.

  • timestamp
    UNIX timestamp to use to generate the time string

 

boolean isDST()

Determines whether the user is currently in daylight savings (DST).

 

boolean isValidDateObj( mixed date )

Determines whether the provided date is a valid javascript Date object.

  • date
    The object to check

 

number timestamp()

Returns the current UNIX timestamp

 

string localeDateString( Date date, object options )

Returns a locale-aware string representing the provided date object. The options parameter can be used to adjust the formatting on browsers that support it. See MDN.

  • date
    A Date object used as the source
  • options
    Options object passed into javascript's toLocaleDateString function. See MDN for supported values.

 

boolean supportsHTMLDate()

Determines whether the HTML5 type='date' input is supported in the current browser.


  Report Guide


×