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])

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

Short Date

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

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

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

Long Date

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

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