fix: add leading zeros to day & month in date format (#6114)

This commit is contained in:
Mathias Mogensen 2024-08-30 10:12:16 +02:00 committed by GitHub
parent 61ad75502f
commit 0fd0900b41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View File

@ -1,11 +1,11 @@
import 'package:appflowy_backend/protobuf/flowy-user/date_time.pbenum.dart'; import 'package:appflowy_backend/protobuf/flowy-user/date_time.pbenum.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
const _localFmt = 'M/d/y'; const _localFmt = 'MM/dd/y';
const _usFmt = 'y/M/d'; const _usFmt = 'y/MM/dd';
const _isoFmt = 'y-M-d'; const _isoFmt = 'y-MM-dd';
const _friendlyFmt = 'MMM d, y'; const _friendlyFmt = 'MMM dd, y';
const _dmyFmt = 'd/M/y'; const _dmyFmt = 'dd/MM/y';
extension DateFormatter on UserDateFormatPB { extension DateFormatter on UserDateFormatPB {
DateFormat get toFormat => DateFormat(_toFormat[this] ?? _friendlyFmt); DateFormat get toFormat => DateFormat(_toFormat[this] ?? _friendlyFmt);

View File

@ -1,5 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart';
import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/document/application/document_appearance_cubit.dart'; import 'package:appflowy/plugins/document/application/document_appearance_cubit.dart';
@ -43,7 +45,6 @@ import 'package:flowy_infra/theme.dart';
import 'package:flowy_infra/theme_extension.dart'; import 'package:flowy_infra/theme_extension.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flowy_infra_ui/style_widget/hover.dart'; import 'package:flowy_infra_ui/style_widget/hover.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';