Skip to content

Task dates always show 24-hour time; 12h/AM-PM impossible (dateFormatShort hardcodes add_Hm) #311

Closed

Description

@skburgart

Summary

Task dates in the app (due date, start date, end date, reminders) are always rendered in 24-hour time. There is no way to get 12-hour AM/PM display: the format is hardcoded, so it ignores the user's Vikunja Time format setting, the device locale, and Android's system "Use 24-hour format" toggle.

Root cause

lib/core/utils/date_extensions.dart uses add_Hm(), which is the locale-independent 24-hour skeleton (H = hour 0–23):

import 'package:intl/intl.dart';
extension DateExtensions on DateTime {
String formatShort([String? locale]) {
return dateFormatShort().format(this);
}
}
DateFormat dateFormatShort([String? locale]) {
return DateFormat.yMMMd(locale).add_Hm();
}

DateFormat dateFormatShort([String? locale]) {
  return DateFormat.yMMMd(locale).add_Hm();   // <- always 24h
}

This drives every task date shown in the UI, via formatShort() in task_bottom_sheet.dart (due/start/end/reminder) and add_task_dialog.dart, plus the editable VikunjaDateTimeField (date_time_field.dart:27).

Notably the app is already inconsistent with itself — task_comments.dart:150 uses add_jm(), the locale-aware skeleton (j), so comment timestamps correctly show AM/PM while the task's own due date right above them shows 24-hour.

Secondary bug (same file)

formatShort accepts a locale parameter and then silently drops it — it calls dateFormatShort() with no argument instead of dateFormatShort(locale):

String formatShort([String? locale]) {
  return dateFormatShort().format(this);   // <- locale ignored
}

Steps to reproduce

  1. In the web frontend, set Settings → General → Localization → Date display format to a non-relative option, then Time format → 12-hour (AM/PM).
  2. Open the same account in the Android app on an en_US device with system 24-hour format off.
  3. Open any task with a due time.

Expected: Sep 5, 2026 3:00 PM
Actual: Sep 5, 2026 15:00

Notes / suggested fix

The minimal fix is add_jm() instead of add_Hm(), matching task_comments.dart — j resolves to whatever the locale uses, so en_US gets AM/PM and locales like de_DE keep 24-hour. Passing the locale argument through would fix the second bug at the same time.

A fuller fix would honor the server-side preference: the app already parses frontend_settings into User (lib/data/models/user_dto.dart:34, lib/domain/entities/user.dart:4) but never reads the timeFormat key (12h / 24h) the web frontend writes there, so the setting users find in the web UI has no effect on mobile. Happy to send a PR for whichever direction you prefer.

Environment

  • App: go-vikunja/app @ 95be795 (pubspec 0.1.8-beta)
  • Platform: Android

Activity

  1. added this to the v1.0.0 milestone on Sep 17, 2026
  2. removed this from the v1.0.0 milestone on Nov 13, 2026
  3. leschbenedikt commented on Nov 14, 2026

    @leschbenedikt
    Collaborator

    I just tested this and this will be fixed in the new app

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions