Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2150 mathias 1
if(!dojo._hasResource["dojox.dtl.filter.dates"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2
dojo._hasResource["dojox.dtl.filter.dates"] = true;
3
dojo.provide("dojox.dtl.filter.dates");
4
 
5
dojo.require("dojox.dtl.utils.date");
6
 
7
dojo.mixin(dojox.dtl.filter.dates, {
8
	date: function(value, arg){
9
		// summary: Formats a date according to the given format
10
		if(!value || !(value instanceof Date)) return "";
11
		arg = arg || "N j, Y";
12
		return dojox.dtl.utils.date.format(value, arg);
13
	},
14
	time: function(value, arg){
15
		// summary: Formats a time according to the given format
16
		if(!value || !(value instanceof Date)) return "";
17
		arg = arg || "P";
18
		return dojox.dtl.utils.date.format(value, arg);
19
	},
20
	timesince: function(value, arg){
21
		// summary: Formats a date as the time since that date (i.e. "4 days, 6 hours")
22
		var timesince = dojox.dtl.utils.date.timesince;
23
		if(!value) return "";
24
		if(arg) return timesince(arg, value);
25
		return timesince(value);
26
	},
27
	timeuntil: function(value, arg){
28
		// summary: Formats a date as the time until that date (i.e. "4 days, 6 hours")
29
		var timesince = dojox.dtl.utils.date.timesince;
30
		if(!value) return "";
31
		if(arg) return timesince(arg, value);
32
		return timesince(new Date(), value);
33
	}
34
});
35
 
36
}