Commit 07382ff26c09a637b55403efaaae6562521e12c1
1 parent
7211d9b5
Exists in
master
and in
111 other branches
Format dates
Showing
2 changed files
with
12 additions
and
2 deletions
Show diff stats
js/app/views/EpnTapUI.js
... | ... | @@ -186,7 +186,17 @@ Ext.define('App.util.Format', { |
186 | 186 | return '<p>' + txt + '</p>' |
187 | 187 | }, |
188 | 188 | 'date': function(data) { |
189 | - return data; // TODO | |
189 | + if(isNaN(data)) { | |
190 | + return ''; | |
191 | + } | |
192 | + var f = Number(data) + 1401 + Math.floor((Math.floor((4 * Number(data) + 274277) / 146097) * 3) / 4) - 38; | |
193 | + var e = 4 * f + 3; | |
194 | + var g = Math.floor((e % 1461) / 4); | |
195 | + var h = 5 * g + 2; | |
196 | + var D = Math.floor((h % 153) / 5) + 1; | |
197 | + var M = ((Math.floor(h / 153) + 2) % 12) + 1; | |
198 | + var Y = Math.floor(e / 1461) - 4716 + Math.floor((12 + 2 - M) / 12); | |
199 | + return Ext.Date.format(new Date(Y, M-1, D), 'Y-m-d'); | |
190 | 200 | }, |
191 | 201 | 'number': function(val) { |
192 | 202 | if(val < 0) { | ... | ... |
php/epntap.php
... | ... | @@ -120,7 +120,7 @@ function getGranules() { |
120 | 120 | |
121 | 121 | $visibleColumns = ['granule_uid', 'dataproduct_type', 'time_min', 'time_max', 'access_estsize', 'thumbnail_url', 'access_url']; |
122 | 122 | $names = ['dataproduct_type' => 'Type', 'access_estsize' => 'Size']; |
123 | - $renderers = ['dataproduct_type' => 'type', 'access_estsize' => 'size', 'access_format' => 'format', 'access_url' => 'link', 'thumbnail_url' => 'img']; | |
123 | + $renderers = ['dataproduct_type' => 'type', 'time_min' => 'date', 'time_max' => 'date', 'access_estsize' => 'size', 'thumbnail_url' => 'img', 'access_url' => 'link', 'access_format' => 'format']; | |
124 | 124 | $flexs = ['granule_uid' => 2]; |
125 | 125 | |
126 | 126 | $fields = array(); | ... | ... |