rluv_client/lib/global/utils.dart
2023-07-19 02:16:13 -06:00

18 lines
475 B
Dart

import 'dart:ui';
import 'package:intl/intl.dart';
String formatDate(DateTime time) {
return DateFormat('EEEE, dd MMMM yyyy').format(time);
}
DateTime dateFromJson(int value) => DateTime.fromMillisecondsSinceEpoch(value);
int dateToJson(DateTime? value) =>
value == null ? 0 : value.millisecondsSinceEpoch;
String colorToJson(Color color) =>
color.toString().split('(0x')[1].split(')')[0];
Color colorFromJson(String hex) => Color(int.parse(hex, radix: 16));