+++ /dev/null
-/*\r
- * Ext JS Library 0.30\r
- * Copyright(c) 2006-2009, Ext JS, LLC.\r
- * licensing@extjs.com\r
- * \r
- * http://extjs.com/license\r
- */\r
-\r
-// generates a renderer function to be used for textual date groups\r
-Ext.util.Format.createTextDateRenderer = function(){\r
- // create the cache of ranges to be reused\r
- var today = new Date().clearTime(true);\r
- var year = today.getFullYear();\r
- var todayTime = today.getTime();\r
- var yesterday = today.add('d', -1).getTime();\r
- var tomorrow = today.add('d', 1).getTime();\r
- var weekDays = today.add('d', 6).getTime();\r
- var lastWeekDays = today.add('d', -6).getTime();\r
-\r
- var weekAgo1 = today.add('d', -13).getTime();\r
- var weekAgo2 = today.add('d', -20).getTime();\r
- var weekAgo3 = today.add('d', -27).getTime();\r
-\r
- var f = function(date){\r
- if(!date) {\r
- return '(No Date)';\r
- }\r
- var notime = date.clearTime(true).getTime();\r
-\r
- if (notime == todayTime) {\r
- return 'Today';\r
- }\r
- if(notime > todayTime){\r
- if (notime == tomorrow) {\r
- return 'Tomorrow';\r
- }\r
- if (notime <= weekDays) {\r
- return date.format('l');\r
- }\r
- }else {\r
- if(notime == yesterday) {\r
- return 'Yesterday';\r
- }\r
- if(notime >= lastWeekDays) {\r
- return 'Last ' + date.format('l');\r
- }\r
- } \r
- return date.getFullYear() == year ? date.format('D m/d') : date.format('D m/d/Y');\r
- };\r
- \r
- f.date = today;\r
- return f;\r
-};
\ No newline at end of file