Skip to content

Add optional top bar date/time with personal visibility toggle#58948

Open
Zhey-on wants to merge 1 commit intonextcloud:masterfrom
Zhey-on:feat/38726-header-datetime-toggle
Open

Add optional top bar date/time with personal visibility toggle#58948
Zhey-on wants to merge 1 commit intonextcloud:masterfrom
Zhey-on:feat/38726-header-datetime-toggle

Conversation

@Zhey-on
Copy link
Copy Markdown

@Zhey-on Zhey-on commented Mar 14, 2026

Summary

Fixes #38726.

This adds an optional date and time label in the top bar next to the account menu.
This is intentionally not a dashboard widget.

Users can enable or disable it from Personal settings > Appearance and accessibility settings, under a new Visibility options switch.

What changed

  • Added a reusable HeaderDateTime component for top bar rendering.
  • Integrated it in the account menu area, not in Unified Search.
  • Added a new personal setting: Show date and time in top bar.
  • Persisted the setting as theming/show_header_datetime with yes/no values.
  • Exposed the setting via initial state on authenticated pages.
  • Allowed and validated the new preference key in theming preference validation.
  • Kept runtime behavior live by emitting and listening to an event bus update.
  • Updated built frontend assets.

Testing

  • npm run build -- --filter=core
  • php -l apps/theming/lib/Listener/BeforeTemplateRenderedListener.php
  • php -l apps/theming/lib/Settings/Personal.php
  • php -l apps/theming/lib/Listener/BeforePreferenceListener.php

@Zhey-on Zhey-on requested review from a team as code owners March 14, 2026 19:04
@Zhey-on Zhey-on requested review from artonge, icewind1991, nfebe, sorbaugh and szaimen and removed request for a team March 14, 2026 19:04
@Zhey-on Zhey-on force-pushed the feat/38726-header-datetime-toggle branch from 04cfd60 to 654dee9 Compare March 14, 2026 19:10
@szaimen szaimen added this to the Nextcloud 34 milestone Mar 16, 2026
@szaimen szaimen added enhancement 3. to review Waiting for reviews labels Mar 16, 2026
@szaimen szaimen requested review from susnux and removed request for szaimen March 16, 2026 09:33
Comment on lines +6 to +8
<span v-if="enabled" class="header-date-time" :title="localizedDateTime">
{{ localizedDateTime }}
</span>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should rather just use NcDateTime from nextcloud-vue

Comment on lines +11 to +14
<script lang="ts">
import { defineComponent } from 'vue'

export default defineComponent({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new files should - if possible - use script setup syntax to be future proof

</ul>
</NcHeaderMenu>
<div class="account-menu-wrapper">
<HeaderDateTime :enabled="showHeaderDateTime" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this belongs to the account menu

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how are those changes related?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this related?

@susnux
Copy link
Copy Markdown
Contributor

susnux commented Mar 17, 2026

Thank you for your contribution!
But please use the pull request template to make review easier and to keep all required todo fields.

Could you please add screen shots so we can get a review of the @nextcloud/designers to decide if this is something we want to have in the product :)

@kra-mo
Copy link
Copy Markdown
Member

kra-mo commented Mar 17, 2026

I don't think we want this from a design POV. Every operating system already has a way to show the date and time in their own bar. The dashboard? Sure, maybe. It has the advantage of potentially actually being front-and-center unlike the time from the OS. But this seems borderline useless.

@susnux
Copy link
Copy Markdown
Contributor

susnux commented Mar 17, 2026

The dashboard? Sure, maybe. It has the advantage of potentially actually being front-and-center unlike the time from the

I agree as in the dashboard we could then also show timezone offset (e.g. if you are on a public device where local time is 10 am but in Nextcloud you configured a timezone so its 11am.).

@github-actions
Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard: current Date and Time widget

4 participants