refactor: 💡 move date format helpers to core addon

This commit is contained in:
Randall Morey committed 2020-11-18 12:23:26 -05:00
1 parent ed6aefbe9c
commit baa607a16a
8 files changed
+10 -2

No files matched your search

View File
Whitespace-only changes.
@@ -1,5 +1,9 @@
import { helper } from '@ember/component/helper';
/**
* Takes a `Date` instance and returns a string formatted in human-friendly
* ISO-ish, e.g. "2020-01-01 00:00:00".
*/
export default helper(function formatDateIsoHuman(params /*, hash*/) {
return params[0]
.toISOString()
@@ -1,5 +1,9 @@
import { helper } from '@ember/component/helper';
/**
* Takes a `Date` instance and returns a string formatted in ISO,
* e.g. "2020-01-01T00:00:00.999Z".
*/
export default helper(function formatDateIso(params /*, hash*/) {
return params[0].toISOString();
});
@@ -0,0 +1 @@
export { default, formatDateIsoHuman } from 'core/helpers/format-date-iso-human';
@@ -0,0 +1 @@
export { default, formatDateIso } from 'core/helpers/format-date-iso';
Whitespace-only changes.
@@ -6,7 +6,6 @@ import { hbs } from 'ember-cli-htmlbars';
module('Integration | Helper | format-date-iso-human', function (hooks) {
setupRenderingTest(hooks);
// Replace this with your real tests.
test('it renders', async function (assert) {
this.set('inputValue', new Date('2020-01-01T00:00:00.999Z'));
@@ -6,7 +6,6 @@ import { hbs } from 'ember-cli-htmlbars';
module('Integration | Helper | format-date-iso', function (hooks) {
setupRenderingTest(hooks);
// Replace this with your real tests.
test('it renders', async function (assert) {
this.set('inputValue', new Date('2020-01-01T00:00:00.999Z'));