mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	Merge pull request #42 from Unleash/reuse-date
Ensure the same date format everywhere
This commit is contained in:
		
						commit
						2c69096af8
					
				| @ -10,6 +10,7 @@ import { | |||||||
|     Switch, |     Switch, | ||||||
| } from 'react-mdl'; | } from 'react-mdl'; | ||||||
| import { HeaderTitle, ExternalIconLink, shorten } from '../common'; | import { HeaderTitle, ExternalIconLink, shorten } from '../common'; | ||||||
|  | import { formatFullDateTime } from '../common/util'; | ||||||
| 
 | 
 | ||||||
| class StatefulTextfield extends Component { | class StatefulTextfield extends Component { | ||||||
|     constructor (props) { |     constructor (props) { | ||||||
| @ -121,7 +122,7 @@ class ClientApplications extends PureComponent { | |||||||
|                             <ListItemContent |                             <ListItemContent | ||||||
|                                 icon="timeline" |                                 icon="timeline" | ||||||
|                                 subtitle={ |                                 subtitle={ | ||||||
|                                     <span>{clientIp} last seen at <small>{new Date(lastSeen).toLocaleString('nb-NO')}</small></span> |                                     <span>{clientIp} last seen at <small>{formatFullDateTime(lastSeen)}</small></span> | ||||||
|                                 }> |                                 }> | ||||||
|                                 {instanceId} |                                 {instanceId} | ||||||
|                             </ListItemContent> |                             </ListItemContent> | ||||||
|  | |||||||
							
								
								
									
										3
									
								
								frontend/src/component/common/util.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								frontend/src/component/common/util.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | |||||||
|  | const dateTimeOptions = { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit', second: '2-digit' }; | ||||||
|  | 
 | ||||||
|  | export const formatFullDateTime = v => new Date(v).toLocaleString('nb-NO', dateTimeOptions); | ||||||
| @ -5,6 +5,7 @@ import { hashHistory, Link } from 'react-router'; | |||||||
| import HistoryComponent from '../history/history-list-toggle-container'; | import HistoryComponent from '../history/history-list-toggle-container'; | ||||||
| import MetricComponent from './metric-container'; | import MetricComponent from './metric-container'; | ||||||
| import EditFeatureToggle from './form-edit-container.jsx'; | import EditFeatureToggle from './form-edit-container.jsx'; | ||||||
|  | import { formatFullDateTime } from '../common/util'; | ||||||
| 
 | 
 | ||||||
| const TABS = { | const TABS = { | ||||||
|     view: 0, |     view: 0, | ||||||
| @ -80,7 +81,7 @@ export default class ViewFeatureToggleComponent extends React.Component { | |||||||
|             <div> |             <div> | ||||||
|                 <h4>{featureToggle.name} <small>{featureToggle.enabled ? 'is enabled' : 'is disabled'}</small> |                 <h4>{featureToggle.name} <small>{featureToggle.enabled ? 'is enabled' : 'is disabled'}</small> | ||||||
|                     <small style={{ float: 'right', lineHeight: '38px' }}> |                     <small style={{ float: 'right', lineHeight: '38px' }}> | ||||||
|                         Created {(new Date(featureToggle.createdAt)).toLocaleString('nb-NO')} |                         Created {formatFullDateTime(featureToggle.createdAt)} | ||||||
|                     </small> |                     </small> | ||||||
|                 </h4> |                 </h4> | ||||||
|                 <div className="mdl-color-text--grey"><small>{featureToggle.description}</small></div> |                 <div className="mdl-color-text--grey"><small>{featureToggle.description}</small></div> | ||||||
|  | |||||||
| @ -3,13 +3,10 @@ import HistoryItemDiff from './history-item-diff'; | |||||||
| import HistoryItemJson from './history-item-json'; | import HistoryItemJson from './history-item-json'; | ||||||
| import { Table, TableHeader } from 'react-mdl'; | import { Table, TableHeader } from 'react-mdl'; | ||||||
| import { HeaderTitle, SwitchWithLabel } from '../common'; | import { HeaderTitle, SwitchWithLabel } from '../common'; | ||||||
|  | import { formatFullDateTime } from '../common/util'; | ||||||
| 
 | 
 | ||||||
| import style from './history.scss'; | import style from './history.scss'; | ||||||
| 
 | 
 | ||||||
| const dateOptions = { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit', second: '2-digit' }; |  | ||||||
| 
 |  | ||||||
| const formatDate = v => (new Date(v)).toLocaleString('nb-NO', dateOptions); |  | ||||||
| 
 |  | ||||||
| class HistoryList extends Component { | class HistoryList extends Component { | ||||||
| 
 | 
 | ||||||
|     toggleShowDiff () { |     toggleShowDiff () { | ||||||
| @ -40,7 +37,7 @@ class HistoryList extends Component { | |||||||
|                 <TableHeader name="type">Type</TableHeader> |                 <TableHeader name="type">Type</TableHeader> | ||||||
|                 <TableHeader name="createdBy">User</TableHeader> |                 <TableHeader name="createdBy">User</TableHeader> | ||||||
|                 <TableHeader name="diff">Diff</TableHeader> |                 <TableHeader name="diff">Diff</TableHeader> | ||||||
|                 <TableHeader numeric name="createdAt" cellFormatter={formatDate}>Time</TableHeader> |                 <TableHeader numeric name="createdAt" cellFormatter={formatFullDateTime}>Time</TableHeader> | ||||||
|             </Table>); |             </Table>); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user