mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 21:33:24 +03:00
9487ff9bae
no issue - preparation for using `ember-pikaday` that utilizes `ember-cli-moment-shim` - removes usage of `moment` global - removes custom imports of `moment` and `moment-timezone` libraries
20 lines
674 B
JavaScript
20 lines
674 B
JavaScript
import {Factory, faker} from 'ember-cli-mirage';
|
|
import moment from 'moment';
|
|
|
|
let randomDate = function randomDate(start = moment().subtract(30, 'days').toDate(), end = new Date()) {
|
|
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
|
|
};
|
|
|
|
let statuses = ['pending', 'subscribed'];
|
|
|
|
export default Factory.extend({
|
|
name() { return `${faker.name.firstName()} ${faker.name.lastName()}`; },
|
|
email: faker.internet.email,
|
|
status() { return statuses[Math.floor(Math.random() * statuses.length)]; },
|
|
createdAt() { return randomDate(); },
|
|
updatedAt: null,
|
|
createdBy: 0,
|
|
updatedBy: null,
|
|
unsubscribedAt: null
|
|
});
|