Skip to content

pd4d10/moment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Moment for Dart

Notice: The version published at pub is just a placeholder, not the production use code.

See discussion issue

Parse, validate, manipulate, and display dates in Dart, with similar API to momentjs

Usage

import 'package:moment/moment.dart';

main() {
  Moment.now();

  var m = Moment('2018-09-15 16:28:58Z');
  // Get
  m.year; // 2018
  m.quarter; // 3
  m.month; // 9
  m.day; // 15
  m.weekday; // 6 (Saturday)
  m.hour; // 16
  m.minute; // 28
  m.second; // 58

  // Manipulate
  m.add(years: 1, quarters: 2, months: 3);
  m.subtract(weeks: 1, days: 2, hours: 3);

  m.startOf(MomentUnit.year); // Start of the year
  m.startOf(MomentUnit.week); // Start of the week

  // Display
  m.format('yyyy-MM-dd');
}

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages