Files
threshold-ui/addons/core/addon/helpers/format-date-iso-human.js
T

17 lines
417 B
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
2020-09-18 12:54:31 -04:00
import { helper } from '@ember/component/helper';
2020-11-18 12:23:26 -05:00
/**
* Takes a `Date` instance and returns a string formatted in human-friendly
* ISO-ish, e.g. "2020-01-01 00:00:00".
*/
2020-11-16 15:08:59 -05:00
export default helper(function formatDateIsoHuman(params /*, hash*/) {
return params[0]
.toISOString()
2020-09-18 12:54:31 -04:00
.replace('T', ' ')
.replace(/\.\d*Z/, '');
});