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

Support timezone in notifications #40

Closed
ksurl opened this issue Jul 14, 2021 · 25 comments · Fixed by #1213
Closed

Support timezone in notifications #40

ksurl opened this issue Jul 14, 2021 · 25 comments · Fixed by #1213
Labels
area:notifications Everything related to notifications feature-request Request for new features to be added

Comments

@ksurl
Copy link

ksurl commented Jul 14, 2021

apk add tzdata to docker image and support TZ environment variable to set the timezone. alpine is pretty straightforward. you just add this to the start up before running the app

cp -f "/usr/share/zoneinfo/${TZ}" /etc/localtime && echo "${TZ}" > /etc/timezone.

I would suggest a script to run the cp and the npm startup and set the script as the entrypoint

@louislam
Copy link
Owner

Timezone is already handled in the frontend and you can change in the "Settings" page.
All dates stored in SQLite are in UTC.

@ksurl
Copy link
Author

ksurl commented Jul 14, 2021

The discord notification uses utc time

image

@rezzorix
Copy link
Contributor

Interesting.

Just realized that for Discord notifications the time of incident is sent.
In Telegram notifications just give information on that status - without any time...

@louislam
maybe would be good to either streamline notification texts on backend for each service
OR (maybe even better)
let users customise the notification text (including setting a timezone for this notifications)

I really would contribute more than only writing enhancements and testing builds but my coding skill are far too limited ... 😔

@louislam louislam added the feature-request Request for new features to be added label Jul 15, 2021
@Simon-Peham
Copy link

The same is in the Slack notifications it is also in UTC

@tgxn
Copy link
Contributor

tgxn commented Sep 2, 2021

Same for all the notifications I think; they are all UTC. I'd like for them to follow the instance timezone, if configured (if it's "Auto" or not configured we can consider it to be UTC, as we can't infer the client data from the server)

Instance Timezone:
image

@kamilmirza
Copy link

same problem with Pushover notifications
configured desired UTC but no go in Settings
Screenshot_20210920-204404535

@chris-ard
Copy link

Yeah, having the same issue over Slack. Loving Uptime Kuma so far - awesome polish. However, for us to use in production the timezone really needs to be considered in the message (or have it customizable).

For example, we have clients in US, parts of EU, and Australia. The timestamp from Slack takes a lot of figuring out because it will only show us time here. It's also bit confusing as well that it doesn't match relative to the time within slack.

@MostHated
Copy link

It would definitely be nice to have all times used within the system to use the proper timezone. While the interface has the right time by setting the timezone, that doesn't really do anything for me, as I don't often look at the interface. I am attempting to pull the data from "api/status-page/heartbeat" to use in various automations.

@windware-ono
Copy link

Hello. I'd like the fix implemented. This should be a quick fix.

@FrancisHG
Copy link

++ Same, I am using Slack and it is using UTC for text notification, not the configured timezone in UptimeKuma.

@pbunluesin
Copy link

I got this issue with Line Notification. it's effect with production which need accurate time.

@drtech981
Copy link

Bump, still having this issue. It is messing up with quick fixes since some of my clients are around -13 hrs behind our timezone.
Already have set TZ in uptime-kuma as well as on the ubuntu machine.

@BeyondVertical
Copy link
Contributor

BeyondVertical commented Jun 7, 2022

Same problem here with mails. Would be great if this is fixed.
I have docker running and have /etc/timezone in the container via volumes. It is set there correct, but not right in the logs and the pushes.

@stavros-k
Copy link

stavros-k commented Jul 1, 2022

I don't think +1 ing this does not provide any help. Since it's still open, it's an issue. Use the "reactions" on the top post to show you "want" this implemented. Keeps the chat clean and will be easier for contributors to discuss how that would be implemented.

Also reduces the notification "spam" with useless comments to everyone subscribed on this issue.

@mbacicc
Copy link

mbacicc commented Sep 12, 2022

I'm also having timezone problems with email notification.

It would be easily solved by installing tzdata in the base image (both debian and alpine have this package) and passing the TZ env var in the docker container.

@yyahari
Copy link

yyahari commented Sep 13, 2022

Como solucion a este error en particular con respecto a smtp
hicimos uunas modificaciones,
1.apt update && apt install tzdata -y
2.dpkg-reconfigure tzdata
3.Seleccione mi time zone correspondiente
4.corri "date" dandome la fecha y hora de mi zona horaria
5.edite el archivo /app/server/notification-providers/smtp.js
6.comente el campo:
//if (heartbeatJSON) {
// bodyTextContent = ${msg}\nTime (UTC): ${heartbeatJSON["time"]};
// }

  1. agregue;
    let fecha = new Date();
    let fechayhora=fecha.toLocaleString();

    if (heartbeatJSON) {
        bodyTextContent = `${msg}\nTime: ${fechayhora}`;
    }
    
  2. con eso me muestra la hora correcta con respecto a mi pais en los correos
    9.Saludos

@Dr0id1
Copy link

Dr0id1 commented Sep 21, 2022

Do we have an update on that ?

@BeyondVertical
Copy link
Contributor

Do we have an update on that ?

Don't think so. Would be nice to have this feature soon. :)

@louislam louislam linked a pull request Oct 11, 2022 that will close this issue
6 tasks
@louislam
Copy link
Owner

louislam commented Oct 11, 2022

I recently added server side timezone along with the maintenance pull request. It is configurable in the Settings page.

LOUIS-AORUS-15P  006095

It is an example of convertion of utc to server timezone.

dayjs.utc(myDate).local().foarmt(<DATE FORMAT>)

@BeyondVertical
Copy link
Contributor

Awesome. When can we get it in the releases? 😂

@CommanderStorm CommanderStorm added the area:notifications Everything related to notifications label Mar 1, 2024
@CommanderStorm CommanderStorm changed the title Support timezone Support timezone in notifications Mar 1, 2024
@roughnecks
Copy link

Sorry if I'm posting here, but I think this issue is still current with webhooks notifications.

image

image

@CommanderStorm
Copy link
Collaborator

What is your notification template?

@roughnecks
Copy link

"template": "${heartbeat.time}\r\n${msg}"

@CommanderStorm
Copy link
Collaborator

CommanderStorm commented Nov 10, 2024

time is in UTC.
If you want the local time, please use localDateTime instead.
If you want the Timezone in addition, you can use timezone

We know that the documetation surroudning the templating system is quite confusing but have not yet have the time to improve this part

@roughnecks
Copy link

I see, will make the change. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:notifications Everything related to notifications feature-request Request for new features to be added
Projects
None yet
Development

Successfully merging a pull request may close this issue.