How to use the faker.date function in faker

To help you get started, we’ve selected a few faker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elwayman02 / ember-data-github / mirage-support / factories / github-user.js View on Github external
return `user${i}`;
  },
  name: function(i) {
    return `User ${i}`;
  },
  // needs to be the actual related model name for Ember Data reasons? 🤔
  type: 'github-user',
  avatar_url: function(i) {
    return `user${i}-avatar.gif`;
  },
  public_repos: 1,
  public_gists: 2,
  followers: 3,
  following: 4,
  created_at: faker.date.past(),
  updated_at: faker.date.recent(),
  repos_url: function(i) {
    return `https://api.github.com/users/user${i}/repos`;
  },
  url: function(i) {
    return `https://api.github.com/users/user${i}`;
  },

  withRepositories: trait({
    afterCreate(user) {
      server.createList('githubRepository', 2, { owner: user });
    }
  }),
});
github hql287 / Manta / app / helpers / __tests__ / form.spec.js View on Github external
it('should pass correct dueDate data', () => {
    const dueDate = {
      selectedDate: faker.date.future(),
    };
    const validation = validateDueDate(true, dueDate);
    expect(validation).toEqual(true);
  });
});
github CenterForOpenScience / ember-osf / test-support / factories / registration.js View on Github external
        dateRegistered: () => faker.date.past(1),
        pendingRegistrationApproval: false,
github lykmapipo / sails-hook-validation / test / validation.zupdate.spec.js View on Github external
before(function(done) {
        User
            .createEach([{
                email: _email,
                username: faker.internet.userName(),
                birthday: faker.date.past()
            }, {
                email: __email,
                username: faker.internet.userName(),
                birthday: faker.date.past()
            }])
            .exec(done);
    });
github LockateMe / Lawncipher / tests / migrate_pre.js View on Github external
function generateTestDoc(){
  return {
    firstName: faker.name.firstName(),
    lastName: faker.name.lastName(),
    isFriend: faker.random.boolean(),
    id: faker.random.uuid(),
    creationOrder: faker.random.number(),
    creationDate: faker.date.past(),
    messages: (function(){var a = []; var n = faker.random.number({max: 5}); for (var i = 0; i < n; i++) a.push(faker.lorem.sentence()); return a;})()
  };
}
github webkom-co / airframe-next / app / routes / Tables / Tables / components / TrTableBordered.js View on Github external
_.times(5, (index) => (
                
                    
                        <span>
                            { faker.company.catchPhrase() }
                        </span>
                    
                    
                        <progress style="{{height:" value="{">
                    
                    
                        { faker.date.weekday() }, 12 { faker.date.month() }, 2018
                    
                    
                        { faker.date.weekday() }, 12 { faker.date.month() }, 2018
                    
                    
                        
                            <button color="secondary">
                                <i></i>
                            </button>
                            <button color="secondary">
                                <i></i>
                            </button>
                        
                    
                
            ))</progress>
github webkom-co / airframe-next / app / routes / Tables / Tables / components / TrTableResponsive.js View on Github external
<span>
                            -
                        </span>
                    
                    
                        <div>
                            { faker.address.city() }
                        </div>
                        <span>
                            { faker.address.state() }, { faker.address.country() }
                        </span>
                    
                    
                        { faker.date.weekday() }, 12 { faker.date.month() }, 2018<br>
                        12:34 PM
                    
                    
                        <a id="UncontrolledTooltipRevoke" href="#">
                            <i></i>
                        </a>
                        
                            Revoke
                        
                    
                
            ))
        }
github pekkis / hardcore-react-training / server / src / services / raw / person.js View on Github external
const politicalView = unionized
    ? r.pick(["red", "green"])
    : r.pick(["red", "green", "center", "right", "fascist"]);

  return {
    get age() {
      const d = DateTime.fromJSDate(this.birthDay);
      const now = DateTime.local();
      const diff = now.diff(d, "years").toObject();
      return diff.years;
    },

    id: uuid(),
    firstName: faker.name.firstName(),
    lastName: faker.name.lastName(),
    birthDay: faker.date.past(70, "1999-01-01"),
    gender: r.pick(["m", "f"]),
    handedness: r.pick(["l", "r"]),
    salary: r.integer(2000, 10000),
    email: faker.internet.email(),
    unionized,
    politicalView,
    relatedToCEO: r.pick([
      true,
      false,
      false,
      false,
      false,
      false,
      false,
      false
    ])
github berty / berty / js / packages / berty-storybook / faker.gen.tsx View on Github external
.map((_, index) =&gt; ({
					id: index,
					protocolId: '',
					createdAt: timestamp(_faker.date.recent()),
					updatedAt: timestamp(_faker.date.recent()),
					sentAt: timestamp(_faker.date.recent()),
					editedAt: timestamp(_faker.date.recent()),
					kind: randomValue(_api.berty.chatmodel.Message.Kind),
					body: null,
					hidden: _faker.random.boolean(),
					state: randomValue(_api.berty.chatmodel.Message.State),
					conversationId: _faker.random.number() % faker.berty.chatmodel.Conversation.length,
					conversation: faker.berty.chatmodel.Conversation[_.conversationId],
					memberId: _faker.random.number() % faker.berty.chatmodel.Member.length,
					member: faker.berty.chatmodel.Member[_.memberId],
					attachments: [],
					reactions: [],
				}))
			export const Attachment: Array&lt;_api.berty.chatmodel.IAttachment&gt; = randomArray(20)
github qhacks / qhacks-dashboard / packages / server / db / seeders / 20181124185518-seed-data.js View on Github external
oauthUsers.forEach((oauthUser) => {
    hackers.push({
      id: uuidv4(),
      oauthUserId: oauthUser.id,
      firstName: faker.name.firstName(),
      lastName: faker.name.lastName(),
      email: faker.internet.email(),
      phoneNumber: faker.phone.phoneNumber(),
      dateOfBirth: faker.date.past(20),
      schoolName: faker.company.companyName(),
      password: faker.internet.password(8),
      createdAt: new Date(),
      updatedAt: new Date()
    });
  });