Jump to content
View in the app

A better way to browse. Learn more.

Learn more

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.

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.