Skip to main content
edited tags
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

I want to use in javascript function Drupal.twith JavaScript and Drupal.t() the equivalent of format_interval functionformat_interval(). With php it's easy:

With PHP I would use the following code.

print t("!date ago", array("!date" => format_interval(time() - $lastActivity, 1)));

but I want to useWhat would the equivalent in Drupal.t which canJavaScript be used in javascript.?

I want to use in javascript function Drupal.t the equivalent of format_interval function. With php it's easy:

print t("!date ago", array("!date" => format_interval(time() - $lastActivity, 1)));

but I want to use in Drupal.t which can be used in javascript.

I want to use with JavaScript and Drupal.t() the equivalent of format_interval().

With PHP I would use the following code.

print t("!date ago", array("!date" => format_interval(time() - $lastActivity, 1)));

What would the equivalent in JavaScript be?

Tweeted twitter.com/#!/StackDrupal/status/336619231389052928
Post Migrated Here from stackoverflow.com (revisions)
Source Link

Which is the equivalent of php drupal format_interval for javascript?

I want to use in javascript function Drupal.t the equivalent of format_interval function. With php it's easy:

print t("!date ago", array("!date" => format_interval(time() - $lastActivity, 1)));

but I want to use in Drupal.t which can be used in javascript.