core library
Chronoverse core: pure-Dart date math, formatting, parsing, recurrence, calendar-system conversions, events and iCalendar.
Import this alone in models, repositories, isolates or tests that must not depend on Flutter widgets:
import 'package:chronoverse/core.dart';
Classes
- ByWeekday
-
A weekday, optionally with a position: "every Monday" (no ordinal),
"the 2nd Tuesday" (
ordinal: 2) or "the last Friday" (ordinal: -1). - CalendarConverter
- Conversions between calendar systems, Julian Day Numbers, Unix time and spreadsheet serial numbers.
- CalendarDate
- A date in some CalendarSystem.
-
CalendarEvent<
T> - An event shown in calendar views. Pure Dart, so it works in models, repositories and server code without Flutter.
- CalendarSource
- One calendar in a multi-calendar app (Work, Personal, Holidays...).
- Chrono
- One place to find every date and time function in Chronoverse.
- ChronoFormat
-
Formats and parses dates with a pattern such as
dd MMM yyyy, hh:mm a. - ChronoLocale
- Localised words and conventions for one language.
- ChronoStrings
- Short UI strings used by the widgets.
- ChronoTimeZone
- A named time zone with a standard offset and an optional DST rule.
- DateAvailability
- Which days can be picked: combine blocked dates, blocked ranges, blocked weekdays, an allow-list and your own rule. Pure Dart, so the same rules can be validated on a server.
- DateDifference
- A calendar difference broken into years, months and days, as people say it ("2 years, 3 months and 5 days").
- DateMath
- Date calculations that need more than one date.
- DateRange
- An inclusive range of calendar days, from start to end.
- DateRangeTime
- A time span with exact start and end instants (unlike DateRange, which is whole days).
- DstRule
- A daylight-saving rule: when it starts, when it ends and how much clocks move (save).
- DstTransition
- When daylight-saving time starts or ends in a year: the nth weekday of month (negative nth counts from the end) at minutes past midnight, measured in local standard time, or in UTC when utc.
- EventAttendee
- An invited person.
-
EventOccurrence<
T> - One concrete occurrence of a (possibly repeating) CalendarEvent.
- EventPerson
- A person attached to an event.
- EventReminder
- A reminder some time before an event.
- ICalendar
-
Reads and writes iCalendar (
.ics, RFC 5545) VEVENTs, the format used by every major calendar app and service for import and export. - NaturalDateParser
- Understands what people type into a date box:
- RecurrenceRule
- A repeat rule compatible with iCalendar RRULE (RFC 5545): FREQ, INTERVAL, COUNT, UNTIL, BYDAY, BYMONTHDAY, BYMONTH, BYSETPOS, WKST.
- RelativeTime
- "in 3 days", "2 hours ago", "Yesterday" in any ChronoLocale.
- Schedule
- Free/busy and overlap helpers.
- ZonedDateTime
-
A moment in time viewed at a fixed UTC offset, such as
+05:30.
Enums
- AttendeeResponse
- An attendee's answer.
- CalendarSystem
- A non-Gregorian calendar Chronoverse can convert to and from.
- ChronoUnit
- Units used by relative-time formatting.
- EventShowAs
- Whether the event blocks time.
- EventStatus
- Event status.
- EventType
- Kind of event.
- EventVisibility
- Who can see the event details.
- Frequency
- How often a RecurrenceRule repeats.
- PluralRule
- How a language picks a plural form from a count.
- ReminderMethod
- How a reminder is delivered.
- WeekdayStyle
- Weekday label length.
Extensions
-
CalendarEventFiltering
on Iterable<
CalendarEvent< T> > - Multi-calendar helpers.
-
CalendarEventList
on Iterable<
CalendarEvent< T> > - Queries over a list of events.
- CalendarSystemDateTime on DateTime
- Helpers to convert straight from a DateTime.
- ChronoDateTime on DateTime
- Calendar helpers available on every DateTime.
Functions
-
daysInMonth(
int year, int month) → int -
Number of days in
monthofyear(Gregorian). -
formatIcsDate(
DateTime d, {bool dateOnly = false}) → String -
Formats
das an iCalendar DATE-TIME (20261020T154100Zfor UTC, floating local time otherwise) or DATE whendateOnly. -
isLeapYear(
int year) → bool -
Whether
yearis a Gregorian leap year. -
maxDate(
DateTime a, DateTime b) → DateTime - Largest of two dates.
-
minDate(
DateTime a, DateTime b) → DateTime - Smallest of two dates.
-
nthWeekdayOf(
int year, int month, int n, int weekday, {bool utc = false}) → DateTime? -
The
nthweekdayofmonth/year; negativencounts from the end. -
parseIcsDate(
String s) → DateTime -
Parses an iCalendar DATE (
20261020) or DATE-TIME (20261020T154100/...Z). -
sameZone(
DateTime ref, int year, [int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0]) → DateTime -
Builds a DateTime in the same zone kind (UTC or local) as
ref.