Age2 - A Flutter package to calculate someone's age in days, months, and years

Related tags

Templates age2
Overview

age

A Flutter package to calculate someone's age in days, months, and years; in addition it can be used to find the difference between two dates.

Since the original package hasn't been updated for more than 2 years, this package is an extension of the original

Getting Started

In your flutter project add the dependency:

dependencies:
  ...
  age: ^1.0.0

For help getting started with Flutter, view the online documentation.

Example

import 'package:age/age.dart';

void main() {
  DateTime birthday = DateTime(1990, 1, 20);
  DateTime today = DateTime.now(); //2020/1/24

  AgeDuration age;

  // Find out your age
  age = Age.dateDifference(
      fromDate: birthday, toDate: today, includeToDate: false);

  print('Your age is $age'); // Your age is Years: 30, Months: 0, Days: 4

  // Find out when your next birthday will be.
  DateTime tempDate = DateTime(today.year, birthday.month, birthday.day);
  DateTime nextBirthdayDate = tempDate.isBefore(today)
      ? Age.add(date: tempDate, duration: AgeDuration(years: 1))
      : tempDate;
  AgeDuration nextBirthdayDuration =
      Age.dateDifference(fromDate: today, toDate: nextBirthdayDate);

  print('You next birthday will be on $nextBirthdayDate or in $nextBirthdayDuration');
  // You next birthday will be on 2021-01-20 00:00:00.000 or in Years: 0, Months: 11, Days: 27
}
You might also like...

Flutter Calculate - Flutter app

Flutter Calculate - Flutter app

Flutter_Calculate 计算小助手 功能: 矩阵常规计算(如矩阵相乘,相减,与某个数相乘等) 三角函数计算(包括度分秒,度与弧度之间的转换,sin,arctan等三角函数) 自定义函数(可以通过自定义函数大大简化计算工作) 定积分计算 多项式计算(通过求矩阵特征值) 线性方程组求解 矩阵

Dec 16, 2022

BMI Calcaluator - Flutter app to calculate Body mass index (BMI)

flutter_learn A new Flutter application. Getting Started This project is a starting point for a Flutter application. A few resources to get you starte

Jan 3, 2022

Voxxedapp - A Flutter app for iOS and Android that display details about upcoming Voxxed Days

Voxxedapp - A Flutter app for iOS and Android that display details about upcoming Voxxed Days

voxxedapp - a Voxxed Days schedule app made with Flutter What is voxxedapp? It's an app that displays info about upcoming Voxxed Days conferences, inc

Oct 10, 2020

Control your week, days, hours, and even minutes. ⏳

Control your week, days, hours, and even minutes. ⏳

Info An advanced, minimalist, and powerful time management application. Where you can create the task, give it a duration, and select which weekdays y

Dec 18, 2022

Find out what you did all the days and unlock moments you completely forgot!

This project has been replaced by Relieve Quid Faciam Hodie What did I do today? Find out what you did all these days and unlock moments you completel

Oct 27, 2022

Flutter dating app, HCM DevFest 2021 - we gonna kill the festival est time to complete 3 days

Flutter dating app, HCM DevFest 2021 - we gonna kill the festival est time to complete 3 days

lovebird A new Flutter project. Installation the application only run on real device due to GPS functionality. build release on Android/IOS/ Web i

May 24, 2022

ui app , coded with help of codepur tut - 30 days of flutter - this is my first app

my_shop A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Apr 10, 2022

This is my participation Repo for the 100 days of coding challenge

hundred_days_of_coding Day 1: Started creating Project and using advanced tools to make the development easier Day 2: Added DataClasses with the help

Nov 21, 2021

This repo is for Mobile developer participants of 20 Days of Open source.

20 Days Of Open Source 20 DAYS OF Open Source Event details : 20 Days of Open Source is a 20 Days long event. It is organized by Trinity Cyber Forum &

Nov 4, 2022
Owner
Charles Dyason
Charles Dyason
Age-Calculator - Age Calculator For Flutter

Age-Calculator(Contributed by YEASEEN AHMED)

CPAD-Gazipur 2 Oct 9, 2022
Age-Calculator-Lambda - Age Calculator Lambda With Flutter

Age-Calculator-Lambda(Contributed by YEASEEN AHMED)

CPAD-Gazipur 4 Nov 13, 2022
Mappy 2.0, 16 months later

Mappy 2 Remake and slight overhaul of the Mappy app, 16 months later, which was developed to showcase the integration of Mapbox in Flutter. Currently,

Peter Aleksander Bizjak 8 Jun 22, 2022
The Flutter plugin that help you can choose dates and years with rounded calendars and customizable themes.

Flutter Rounded Date Picker The Flutter plugin that help you can choose dates and years with rounded calendars and customizable themes. Installing Add

benznest 313 Dec 22, 2022
Internationalized dialog for picking a single month from an infinite list of years.

month_picker_dialog Internationalized material style dialog for picking a single month from an infinite list of years. This package makes use of the i

Dimitri Krivoj 65 Nov 30, 2022
A Machine Learning App for an Age-Old Debate. Coming April 1st 2019.

Sandwhich Website | Twitter Sandwhich is a mobile app built to solve the sandwich debate by determining if the picture you've taken is a sandwich usin

null 140 Dec 28, 2022
A flutter app which calculate your heart beat and takes few inputs and predict whether you have heart disease or not.

Heart Care App ?? ?? ❤️ ⭐️ Features: ⚡️ Lets you sign up and login ⚡️ Montioring your heart failure risk and heart beat through charts ⚡️ View Medical

HINA KHADIM 8 Oct 31, 2022
A simple app to calculate BMI, with a beautiful and minimalistic UI.

practice A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Laksh Mittal 0 Nov 6, 2021
Attendancelist - App to add Students attendance based on roll numbers and calculate percentage.

attedance A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if thi

null 0 Jan 1, 2022
Bmi calculator flutter - Calculate your BMI(Body Mass Index) with this app made with flutter.

bmi_calculator_flutter A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you s

Joel Nickson 1 Jan 2, 2022