Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tee/fix invalid date 3 #223

Merged
merged 1 commit into from
Aug 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/app/rpkm/staff/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ConfirmationModal from '@/components/rpkm/staff/home/qrscanner/confirmati
import { CheckIn } from '@/types/checkIn';
import { FRESHYNIGHT_EVENT, RPKM_DAY_1, RPKM_DAY_2 } from '@/utils/date';
import StudentCodeInput from '@/components/rpkm/staff/home/qrscanner/StudentCodeInput';
import moment from 'moment';
// import moment from 'moment';

function Page() {
const [eventText, setEventText] = useState<string>('');
Expand Down Expand Up @@ -81,14 +81,18 @@ function Page() {

if (newCheckInData) {
if (newCheckInData.checkIn.isDuplicate) {
const date = moment(newCheckInData.checkIn.timestamp);
// const date = moment(newCheckInData.checkIn.timestamp);
let time = newCheckInData.checkIn.timestamp.split(' ')[1];
time =
((parseInt(time.split(':')[0]) + 7) % 24) + ':' + time.split(':')[1];

setStatus('error');
setError(
<div>
ผู้ใช้สแกน QR-code นี้แล้ว
<br />
<div>{newCheckInData.checkIn.timestamp}</div>
{`เมื่อเวลา ${date.format('HH:mm')} น.`}
{/* {`เมื่อเวลา ${date.format('HH:mm')} น.`} */}
{`เมื่อเวลา ${time} น.`}
</div>
);
setErrorTopic('Already taken!');
Expand Down
Loading