Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.
larukedi edited this page Nov 17, 2014 · 6 revisions

Human-readable time span

Usage: $l.date.parseEpoch(timespan[, limitWithWeeks])

console.log($l.date.parseEpoch(5000)); // returns '5 seconds'

Short Date

Usage: $l.date.getDateString(date[, monthNames])

console.log($l.date.getDateString(new Date())); // returns 'now'
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);

console.log($l.date.getDateString(yesterday)); // returns 'a day'
var someday = new Date(2010, 1, 1, 0, 0);
console.log($l.date.getDateString(someday)); // returns '01.02.2010'
console.log($l.date.getDateString(someday, true)); // returns '01 Feb 2010'

Long Date

Usage: $l.date.getLongDateString(date[, monthNames, includeTime])

var now = new Date(); 
console.log($l.date.getLongDateString(now)); // returns '17.11.2014'
console.log($l.date.getLongDateString(now, true)); // returns '17 Nov 2014'
console.log($l.date.getLongDateString(now, true, true)); // returns '17 Nov 2014 01:47'
Clone this wiki locally