mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 21:25:42 +00:00 
			
		
		
		
	Pass dates displayed in front-end tables through the date formatter
This commit is contained in:
		| @@ -165,6 +165,9 @@ function loadAttachmentTable(url, options) { | ||||
|             { | ||||
|                 field: 'upload_date', | ||||
|                 title: '{% trans "Upload Date" %}', | ||||
|                 formatter: function(value) { | ||||
|                     return renderDate(value); | ||||
|                 } | ||||
|             }, | ||||
|             { | ||||
|                 field: 'actions', | ||||
|   | ||||
| @@ -1961,6 +1961,9 @@ function loadBuildTable(table, options) { | ||||
|                 field: 'creation_date', | ||||
|                 title: '{% trans "Created" %}', | ||||
|                 sortable: true, | ||||
|                 formatter: function(value) { | ||||
|                     return renderDate(value); | ||||
|                 } | ||||
|             }, | ||||
|             { | ||||
|                 field: 'issued_by', | ||||
| @@ -1990,11 +1993,17 @@ function loadBuildTable(table, options) { | ||||
|                 field: 'target_date', | ||||
|                 title: '{% trans "Target Date" %}', | ||||
|                 sortable: true, | ||||
|                 formatter: function(value) { | ||||
|                     return renderDate(value); | ||||
|                 } | ||||
|             }, | ||||
|             { | ||||
|                 field: 'completion_date', | ||||
|                 title: '{% trans "Completion Date" %}', | ||||
|                 sortable: true, | ||||
|                 formatter: function(value) { | ||||
|                     return renderDate(value); | ||||
|                 } | ||||
|             }, | ||||
|         ], | ||||
|     }); | ||||
|   | ||||
| @@ -848,11 +848,17 @@ function loadPurchaseOrderTable(table, options) { | ||||
|                 field: 'creation_date', | ||||
|                 title: '{% trans "Date" %}', | ||||
|                 sortable: true, | ||||
|                 formatter: function(value) { | ||||
|                     return renderDate(value); | ||||
|                 } | ||||
|             }, | ||||
|             { | ||||
|                 field: 'target_date', | ||||
|                 title: '{% trans "Target Date" %}', | ||||
|                 sortable: true, | ||||
|                 formatter: function(value) { | ||||
|                     return renderDate(value); | ||||
|                 } | ||||
|             }, | ||||
|             { | ||||
|                 field: 'line_items', | ||||
| @@ -1269,16 +1275,25 @@ function loadSalesOrderTable(table, options) { | ||||
|                 sortable: true, | ||||
|                 field: 'creation_date', | ||||
|                 title: '{% trans "Creation Date" %}', | ||||
|                 formatter: function(value) { | ||||
|                     return renderDate(value); | ||||
|                 } | ||||
|             }, | ||||
|             { | ||||
|                 sortable: true, | ||||
|                 field: 'target_date', | ||||
|                 title: '{% trans "Target Date" %}', | ||||
|                 formatter: function(value) { | ||||
|                     return renderDate(value); | ||||
|                 } | ||||
|             }, | ||||
|             { | ||||
|                 sortable: true, | ||||
|                 field: 'shipment_date', | ||||
|                 title: '{% trans "Shipment Date" %}', | ||||
|                 formatter: function(value) { | ||||
|                     return renderDate(value); | ||||
|                 } | ||||
|             }, | ||||
|             { | ||||
|                 sortable: true, | ||||
| @@ -1430,9 +1445,9 @@ function loadSalesOrderShipmentTable(table, options={}) { | ||||
|                 sortable: true, | ||||
|                 formatter: function(value, row) { | ||||
|                     if (value) { | ||||
|                         return value; | ||||
|                         return renderDate(value); | ||||
|                     } else { | ||||
|                         return '{% trans "Not shipped" %}'; | ||||
|                         return '<em>{% trans "Not shipped" %}</em>'; | ||||
|                     } | ||||
|                 } | ||||
|             }, | ||||
|   | ||||
| @@ -1820,6 +1820,9 @@ function loadStockTable(table, options) { | ||||
|     col = { | ||||
|         field: 'stocktake_date', | ||||
|         title: '{% trans "Stocktake" %}', | ||||
|         formatter: function(value) { | ||||
|             return renderDate(value); | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     if (!options.params.ordering) { | ||||
| @@ -1833,6 +1836,9 @@ function loadStockTable(table, options) { | ||||
|         title: '{% trans "Expiry Date" %}', | ||||
|         visible: global_settings.STOCK_ENABLE_EXPIRY, | ||||
|         switchable: global_settings.STOCK_ENABLE_EXPIRY, | ||||
|         formatter: function(value) { | ||||
|             return renderDate(value); | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     if (!options.params.ordering) { | ||||
| @@ -1844,6 +1850,9 @@ function loadStockTable(table, options) { | ||||
|     col = { | ||||
|         field: 'updated', | ||||
|         title: '{% trans "Last Updated" %}', | ||||
|         formatter: function(value) { | ||||
|             return renderDate(value); | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     if (!options.params.ordering) { | ||||
| @@ -2649,14 +2658,7 @@ function loadStockTrackingTable(table, options) { | ||||
|         title: '{% trans "Date" %}', | ||||
|         sortable: true, | ||||
|         formatter: function(value) { | ||||
|             var m = moment(value); | ||||
|  | ||||
|             if (m.isValid()) { | ||||
|                 var html = m.format('dddd MMMM Do YYYY'); // + '<br>' + m.format('h:mm a'); | ||||
|                 return html; | ||||
|             } | ||||
|  | ||||
|             return '<i>{% trans "Invalid date" %}</i>'; | ||||
|             return renderDate(value); | ||||
|         } | ||||
|     }); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user