Here you can find the source of timeToJSON()
Date.prototype.timeToJSON = function() { return this.toLocaleTimeString().substring(0,5); };
"use strict"; Date.prototype.timeAgoInWords = function (relativeDate) { var delta; relativeDate = relativeDate || new Date(); delta = parseInt((relativeDate.getTime() - this) / 1000, 10); if (delta < 60) { return 'less than a minute ago'; } else if (delta < 120) { return 'about a minute ago'; ...
var timeFmt = function (aDate) { if (null == aDate) { return ""; else { return new Date(aDate).format("yyyy-MM-dd hh:mm:ss"); };
Date.prototype.timeSecond = function () { return ((this.getSeconds() < 10)?"0":"") + this.getSeconds();
String.prototype.startsWith = function (str){ return this.indexOf(str) === 0; }; timeSince = function (date) { var seconds = Math.floor((new Date() - date) / 1000); var interval = Math.floor(seconds / 31536000); if (interval >= 1) { if(interval == 1){ return "about " + interval + " year ago"; ...
var DAY_WIDTH = 100; var DAY_HEIGHT = 80; var SIDE_DELTA = 2; var DAY_HEADING = ["SUN", "MON", "TUE", "WED", "THU", "FRI", ...
Date.prototype.timeToMidnight = function() {
this.setHours(0);
this.setMinutes(0);
this.setMilliseconds(0);
};
function time_between_in_words(from_date, to_date) return format_milliseconds(Math.abs(from_date.getTime()-to_date.getTime())); function time_ago_in_words(date) return format_milliseconds(Math.abs(Date.now()-date.getTime())); function format_milliseconds(milsecs) ...
var chunks = [ [60 * 60 * 24 * 365, 'year'], [60 * 60 * 24 * 30, 'month'], [60 * 60 * 24 * 7, 'week'], [60 * 60 * 24, 'day'], [60 * 60, 'hour'], [60, 'minute'] ]; Date.prototype.time_since = function() { ...
Date.prototype.timesince = function(now) { var chunks = [ [ 60 * 60 * 24 * 365, 'year', 'years'], [ 60 * 60 * 24 * 30, 'month', 'months' ], [ 60 * 60 * 24, 'day', 'days' ], [ 60 * 60, 'hour', 'hours' ], [ 60, 'minute', 'minutes' ] ]; now = now || new Date(); ...