Skip to content

Commit 928da35

Browse files
author
Lionel Bijaoui
committed
Fix use of moment.js to fecha in dev
1 parent e98e23e commit 928da35

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

dev/full/data.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Fakerator from "fakerator";
2-
import moment from "moment";
2+
import fecha from "fecha";
33

44
let fakerator = new Fakerator();
55

@@ -26,8 +26,8 @@ module.exports = {
2626
user.bio = fakerator.lorem.paragraph();
2727
let dob = fakerator.date.past(40, "1998-01-01");
2828
user.dob = dob.valueOf();
29-
user.time = moment().format("hh:mm:ss");
30-
user.age = moment().year() - moment(dob).year();
29+
user.time = fecha.format(new Date(), "hh:mm:ss");
30+
user.age = fecha.format(new Date().getFullYear() - dob, "YY");
3131
user.rank = fakerator.random.number(1, 10);
3232
user.role = fakerator.random.arrayElement(roles).id;
3333
//user.mobile = fakerator.phone.phoneNumber();

dev/full/schema.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import moment from "moment";
1+
import fecha from "fecha";
22

33
import {
44
validators
@@ -352,7 +352,7 @@ module.exports = {
352352
label: "Created (label field)",
353353
model: "created",
354354
get(model) {
355-
return model && model.created ? moment(model.created).format("LLL") : "-";
355+
// return model && model.created ? fecha.format(model.created,"MMMM D YYYY H") : "-";
356356
},
357357
styleClasses: "half-width"
358358
}, {
@@ -535,8 +535,8 @@ module.exports = {
535535
model: "dob",
536536
required: true,
537537
placeholder: "User's birth of date",
538-
min: moment("1900-01-01").toDate(),
539-
max: moment("2016-01-01").toDate(),
538+
min: fecha.parse("1900-01-01", "YYYY-MM-DD"),
539+
max: fecha.parse("2016-01-01", "YYYY-MM-DD"),
540540
validator: [
541541
validators.date
542542
],

0 commit comments

Comments
 (0)