This repository has been archived by the owner on Aug 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
date
larukedi edited this page Dec 15, 2014
·
6 revisions
Usage: $l.date.parseEpoch(timespan[, limitWithWeeks])
// returns '5 seconds'
console.log($l.date.parseEpoch(5000));
Usage: $l.date.getDateDiffString(date)
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
// returns 'a day'
console.log($l.date.getDateDiffString(yesterday));
Usage: $l.date.getShortDateString(date[, includeTime])
var someday = new Date(2010, 1, 1, 0, 0);
// returns '01.02.2010'
console.log($l.date.getShortDateString(someday));
// returns '01.02.2010 00:00'
console.log($l.date.getShortDateString(someday, true));
Usage: $l.date.getLongDateString(date[, includeTime])
var now = new Date();
// returns '17 November 2014'
console.log($l.date.getLongDateString(now));
// returns '17 November 2014 01:47'
console.log($l.date.getLongDateString(now, true));
Usage: $l.date.getCustomDateString(format, date)
console.log($l.date.getCustomDateString('dd/MM/yyyy HH:ss', new Date()));
// returns '17/11/2014 01:47'
Please don't hesitate to submit issues and pull requests.