refactor: 💡 move date format helpers to core addon
This commit is contained in:
8 files changed
+10
-2
No files matched your search
Whitespace-only changes.
+4
@@ -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.
-1
@@ -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'));
|
||||
|
||||
-1
@@ -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'));
|
||||
|
||||
Reference in new issue
Block a user