Skip to content

Commit

Permalink
Shorten EDU REGEX and fix moment error
Browse files Browse the repository at this point in the history
  • Loading branch information
felmez committed Oct 10, 2021
1 parent dd84a4a commit 6425c89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions client/src/components/UserTable.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react'
import { Table } from 'semantic-ui-react'
import moment from 'moment/min/moment-with-locales';
import moment from "moment";
import trLocale from "moment/locale/tr";

export default function UserTable({ user: { id, name, email, role, createdAt } }) {
moment.locale('tr');
moment.locale('tr', [trLocale])

return (
<Table.Body>
Expand Down
2 changes: 1 addition & 1 deletion util/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports.validateCreateInput = (
const errors = {};

const emailRegEx = /^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/;
const eduRegEx = /[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])+@[0-9a-zA-Z][-\w]*[0-9a-zA-Z]+\.edu\.[a-zA-Z]+/i;
const eduRegEx = /^\.edu\.(?!\s)[a-zA-Z]|\.edu(?!\s)+/;
const isValidEmail = email.match(emailRegEx);
const isEduEmail = email.match(eduRegEx);
const isAcademic = role.trim() === 'öğrenci' || role.trim() === 'görevli';
Expand Down

0 comments on commit 6425c89

Please sign in to comment.