Skip to content
New issue

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

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

Already on GitHub? # to your account

Formmatted date of updated as the 'YYYY/MM/DD HH:mm' #130

Open
wants to merge 1 commit into
base: main-2023
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
"dependencies": {
"@popperjs/core": "2.11.7",
"@prisma/client": "4.13.0",
"bootstrap": "5.2.3",
"boostrap": "^2.0.0",
"bootstrap": "^5.3.2",
"cookie-parser": "1.4.6",
"dayjs": "1.11.7",
"debug": "4.3.4",
"express": "4.18.2",
"express-session": "1.17.3",
Expand Down
30 changes: 30 additions & 0 deletions public/javascripts/bundle.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*!
* Bootstrap v5.3.2 (https://getbootstrap.com/)
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/

/*!
* Sizzle CSS Selector Engine v2.3.10
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2023-02-14
*/

/*!
* jQuery JavaScript Library v3.6.4
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2023-03-08T15:28Z
*/
13 changes: 11 additions & 2 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ const express = require('express');
const router = express.Router();
const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient({ log: [ 'query' ] });
const dayjs = require('dayjs');
const utc = require('dayjs/plugin/utc');
const timezone = require('dayjs/plugin/timezone');
dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.tz.setDefault('Asia/Tokyo');

/* GET home page. */
router.get('/', async (req, res, next) => {
Expand All @@ -12,13 +18,16 @@ router.get('/', async (req, res, next) => {
where: { createdBy: parseInt(req.user.id) },
orderBy: { updatedAt: 'desc' }
});
schedules.forEach((schedule) => {
schedule.formattedUpdatedAt = dayjs(schedule.updatedAt).tz().format('YYYY/MM/DD HH:mm');;
});
res.render('index', {
title: title,
user: req.user,
schedules: schedules
schedules: schedules
});
} else {
res.render('index', { title: title, user: req.user });
res.render('index', { title: title, user: req.user});
}
});

Expand Down
4 changes: 2 additions & 2 deletions views/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extends layout
block content
div.container.my-3
div.p-5.bg-light.rounded-3
h1.text-body 予定調整くん
h1.text-body #{title}
p.lead 予定調整くんは、GitHub で認証でき、予定を作って出欠が取れるサービスです。
div.container
if user
Expand All @@ -19,4 +19,4 @@ block content
tr
td
a(href=`/schedules/${schedule.scheduleId}`) #{schedule.scheduleName}
td #{schedule.updatedAt}
td #{schedule.formattedUpdatedAt}
Loading