Skip to content

Commit

Permalink
Merge branch 'piotrek_n_michal_3' of https://github.com/PiotrTyrakows…
Browse files Browse the repository at this point in the history
…ki/PoopPatrol into piotrek_n_michal_3
  • Loading branch information
Zajaczkowskim committed Sep 28, 2024
2 parents 866ad37 + c55c468 commit 66d5a1a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions parent_app/src/app/list/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@
'use client'
import { useEffect, useState } from 'react';
import Card from '../../components/Card';
import { convertISOToDateTime } from '@/utils/dateTimeConverter';

type ImageData = {
_id: string;
buffer: string; // Base64-encoded string
submittedAt: string;
weight: string; //weight --
face: string; // 1 if happy face, 0 if unhappy face
};



const ImageGallery = () => {
const [images, setImages] = useState<ImageData[]>([]);
const [loading, setLoading] = useState(true);
Expand Down
13 changes: 13 additions & 0 deletions parent_app/src/utils/dateTimeConverter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const convertISOToDateTime = (isoString: string): string => {
const date = new Date(isoString);

const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');

const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
//const seconds = String(date.getSeconds()).padStart(2, '0');

return `${year}-${month}-${day} ${hours}:${minutes}`;
};

0 comments on commit 66d5a1a

Please # to comment.