Showing
4 changed files
with
6 additions
and
4 deletions
... | @@ -20,6 +20,7 @@ | ... | @@ -20,6 +20,7 @@ |
20 | "@koa/cors": "^3.1.0", | 20 | "@koa/cors": "^3.1.0", |
21 | "firebase-admin": "^9.11.1", | 21 | "firebase-admin": "^9.11.1", |
22 | "moment": "^2.29.1", | 22 | "moment": "^2.29.1", |
23 | + "moment-timezone": "^0.5.33", | ||
23 | "mqtt": "^4.2.6", | 24 | "mqtt": "^4.2.6", |
24 | "node-cron": "^3.0.0" | 25 | "node-cron": "^3.0.0" |
25 | }, | 26 | }, | ... | ... |
1 | const mongoose = require('mongoose'); | 1 | const mongoose = require('mongoose'); |
2 | const moment = require('moment'); | 2 | const moment = require('moment'); |
3 | +require('moment-timezone'); | ||
3 | 4 | ||
4 | const Schema = mongoose.Schema; | 5 | const Schema = mongoose.Schema; |
5 | 6 | ||
... | @@ -35,9 +36,9 @@ PatientInfoSchema.methods.setUseYn = function(useYn) { | ... | @@ -35,9 +36,9 @@ PatientInfoSchema.methods.setUseYn = function(useYn) { |
35 | }; | 36 | }; |
36 | 37 | ||
37 | PatientInfoSchema.methods.updateInfo = function(info) { | 38 | PatientInfoSchema.methods.updateInfo = function(info) { |
38 | - const date = moment(new Date()).format('YYYY-MM-DD hh:mm'); | 39 | + const date = moment.tz('Asia/Seoul').format('YYYY-MM-DD HH:mm'); |
39 | if(this.info.length) | 40 | if(this.info.length) |
40 | - this.info = this.info.concat('\n\n', `${date} ➡ ${info}`); | 41 | + this.info = this.info.concat('\n\n', `${date} -> ${info}`); |
41 | else | 42 | else |
42 | this.info = `${date} ➡ ${info}`; | 43 | this.info = `${date} ➡ ${info}`; |
43 | }; | 44 | }; | ... | ... |
... | @@ -86,7 +86,7 @@ const transPublishingTopicAndMessage = async(bottleId) => { | ... | @@ -86,7 +86,7 @@ const transPublishingTopicAndMessage = async(bottleId) => { |
86 | const bottleMedicine = await BottleMedicine.findOne({ bottleId, useYn : 'Y' }); | 86 | const bottleMedicine = await BottleMedicine.findOne({ bottleId, useYn : 'Y' }); |
87 | const takeMedicineHist = await TakeMedicineHist.find({ | 87 | const takeMedicineHist = await TakeMedicineHist.find({ |
88 | bmId : bottleMedicine._id | 88 | bmId : bottleMedicine._id |
89 | - }).sort((a, b) => a.takeDate < b.takeDate)[0]; | 89 | + }).sort({ takeDate : 'asc' })[0]; |
90 | 90 | ||
91 | const message = 'res/' + await transDate(takeMedicineHist.takeDate) + '/' + bottleMedicine.dosage; | 91 | const message = 'res/' + await transDate(takeMedicineHist.takeDate) + '/' + bottleMedicine.dosage; |
92 | 92 | ... | ... |
... | @@ -2549,7 +2549,7 @@ minimist@^1.1.0, minimist@^1.2.5: | ... | @@ -2549,7 +2549,7 @@ minimist@^1.1.0, minimist@^1.2.5: |
2549 | resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz" | 2549 | resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz" |
2550 | integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== | 2550 | integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== |
2551 | 2551 | ||
2552 | -moment-timezone@^0.5.31: | 2552 | +moment-timezone@^0.5.31, moment-timezone@^0.5.33: |
2553 | version "0.5.33" | 2553 | version "0.5.33" |
2554 | resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.33.tgz#b252fd6bb57f341c9b59a5ab61a8e51a73bbd22c" | 2554 | resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.33.tgz#b252fd6bb57f341c9b59a5ab61a8e51a73bbd22c" |
2555 | integrity sha512-PTc2vcT8K9J5/9rDEPe5czSIKgLoGsH8UNpA4qZTVw0Vd/Uz19geE9abbIOQKaAQFcnQ3v5YEXrbSc5BpshH+w== | 2555 | integrity sha512-PTc2vcT8K9J5/9rDEPe5czSIKgLoGsH8UNpA4qZTVw0Vd/Uz19geE9abbIOQKaAQFcnQ3v5YEXrbSc5BpshH+w== | ... | ... |
-
Please register or login to post a comment