Skip to content

Commit

Permalink
fix(dashboard): fix am-pm dates (#513)
Browse files Browse the repository at this point in the history
  • Loading branch information
rap2hpoutre authored Mar 21, 2022
1 parent 61fbcdb commit 1cb83d0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dashboard/src/components/Comments.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable react-hooks/exhaustive-deps */
import React, { useEffect, useMemo, useState } from 'react';
import styled from 'styled-components';
import dayjs from 'dayjs';
import { Modal, Input, Button as CloseButton, Col, Row, ModalHeader, ModalBody, FormGroup, Label } from 'reactstrap';
import { toastr } from 'react-redux-toastr';
import DatePicker from 'react-datepicker';
Expand All @@ -20,6 +19,7 @@ import { useRecoilState, useRecoilValue } from 'recoil';
import { dateForDatePicker } from '../services/date';
import { loadingState } from './Loader';
import useApi from '../services/api';
import { formatDateTimeWithNameOfDay } from '../services/date';

const Comments = ({ personId = '', actionId = '', forPassages = false, onUpdateResults }) => {
const [editingId, setEditing] = useState(null);
Expand Down Expand Up @@ -124,7 +124,7 @@ const Comments = ({ personId = '', actionId = '', forPassages = false, onUpdateR
<CloseButton close onClick={() => deleteData(comment._id)} />
<UserName id={comment.user} wrapper={(name) => <div className="author">{name}</div>} />
<div className="user"></div>
<div className="time">{dayjs(comment.createdAt).format('MMM DD, YYYY | hh:mm A')}</div>
<div className="time">{formatDateTimeWithNameOfDay(comment.createdAt)}</div>
<div className="content">
<p onClick={() => setEditing(comment._id)}>
{comment.comment
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/CreateObservation.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const CreateObservation = ({ observation = {}, forceOpen = 0 }) => {
selected={dateForDatePicker((values.observedAt || values.createdAt) ?? new Date())}
onChange={(date) => handleChange({ target: { value: date, name: 'observedAt' } })}
timeInputLabel="Heure :"
dateFormat="dd/MM/yyyy hh:mm"
dateFormat="dd/MM/yyyy HH:mm"
showTimeInput
id="observation-observedat"
/>
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/scenes/territory-observations/view.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import styled from 'styled-components';
import dayjs from 'dayjs';
import { Button as CloseButton } from 'reactstrap';
import { useRecoilValue } from 'recoil';
import UserName from '../../components/UserName';
import { customFieldsObsSelector } from '../../recoil/territoryObservations';
import CustomFieldDisplay from '../../components/CustomFieldDisplay';
import { teamsState } from '../../recoil/auth';
import { formatDateTimeWithNameOfDay } from '../../services/date';

const fieldIsEmpty = (value) => {
if (value === null) return true;
Expand All @@ -27,7 +27,7 @@ const View = ({ obs, onDelete, onClick, noBorder }) => {
<UserName id={obs.user} wrapper={(name) => <span className="author">{name}</span>} />
<i style={{ marginLeft: 10 }}>(équipe {teams.find((t) => obs.team === t._id)?.name})</i>
</div>
<div className="time">{dayjs(obs.observedAt || obs.createdAt).format('MMM DD, YYYY | hh:mm A')}</div>
<div className="time">{formatDateTimeWithNameOfDay(obs.observedAt || obs.createdAt)}</div>
<div onClick={onClick ? () => onClick(obs) : null} className="content">
{customFieldsObs
.filter((f) => f)
Expand Down

0 comments on commit 1cb83d0

Please sign in to comment.