Skip to content

Commit

Permalink
⭐ new: add date.weekdays and months
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed May 25, 2016
1 parent b9406a3 commit 1574ff6
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
47 changes: 45 additions & 2 deletions lib/locales/default/date/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,49 @@
module.exports = {
months: [],
days: [],
months: [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],

weekdays: [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],

weekdaysShort: [
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
],

weekdaysMin: [
"Su",
"Mo",
"Tu",
"We",
"Th",
"Fr",
"Sa"
],

timezone: require("./timezone"),

past(years, refDate) {
Expand Down
21 changes: 21 additions & 0 deletions test/specs/locales/default/date.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,25 @@ describe("Default date", () => {
expect(fakerator.date.age()).to.be.equal(26);
expect(fakerator.date.age(6, 18)).to.be.equal(18);
});

it("check date.months", () => {
expect(fakerator.populate("#{date.months}")).to.be.equal("September");
expect(fakerator.date.months()).to.be.equal("February");
});

it("check date.weekdays", () => {
expect(fakerator.populate("#{date.weekdays}")).to.be.equal("Friday");
expect(fakerator.date.weekdays()).to.be.equal("Sunday");
});

it("check date.weekdaysShort", () => {
expect(fakerator.populate("#{date.weekdaysShort}")).to.be.equal("Fri");
expect(fakerator.date.weekdaysShort()).to.be.equal("Sun");
});

it("check date.weekdaysMin", () => {
expect(fakerator.populate("#{date.weekdaysMin}")).to.be.equal("Fr");
expect(fakerator.date.weekdaysMin()).to.be.equal("Su");
});

})

0 comments on commit 1574ff6

Please sign in to comment.