2023-04-10 15:36:59 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2019-01-31 06:44:23 +00:00
|
|
|
import moment from 'moment';
|
|
|
|
import Helper from '@ember/component/helper';
|
|
|
|
|
2020-05-04 19:22:10 +00:00
|
|
|
export function formatTs([date], options = {}) {
|
2022-09-23 20:53:28 +00:00
|
|
|
const format = options.short
|
|
|
|
? 'MMM D'
|
|
|
|
: options.timeOnly
|
|
|
|
? 'HH:mm:ss'
|
|
|
|
: "MMM DD, 'YY HH:mm:ss ZZ";
|
2019-01-31 06:44:23 +00:00
|
|
|
return moment(date).format(format);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Helper.helper(formatTs);
|