Skip to content

Update intl dependency version in pubspec.yaml #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 1.6.1

- Add `equals` method to check if two dates are equal
- Add `operator -` to subtract a duration from a date
- Add `operator +` to add a duration to a date


## 1.6.0

- **Fork Release**: Published as `ensemble_date` - a maintained fork of `dart_date`
- Updated package name from `dart_date` to `ensemble_date`
- Updated repository links and documentation
- Improved dependency constraints
- Enhanced pub.dev compatibility

## 1.1.1

- Merge [PR](https://github.com/xantiagoma/dart_date/pull/16) to fix week calculation
Expand Down
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2020 Santiago Montoya Angarita (@xantiagoma)
Copyright (c) 2024 EnsembleUI (https://github.com/EnsembleUI)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
# dart_date
# ensemble_date

Dart Extensions for `DartTime`
Dart Extensions for `DateTime`

dart_date provides the most comprehensive, yet simple and consistent toolset for manipulating Dart dates.
ensemble_date provides the most comprehensive, yet simple and consistent toolset for manipulating Dart dates.

**This package is a maintained fork of [dart_date](https://pub.dev/packages/dart_date), providing continued updates and improvements.**

Inspired by [date-fns](https://date-fns.org/)

## Installation

Add this to your package's `pubspec.yaml` file:

```yaml
dependencies:
ensemble_date: ^1.6.0
```

Then run:

```bash
dart pub get
```

## Usage

- Use `instance.method()` for added methods.
Expand All @@ -27,6 +44,8 @@ Tomorrow: 2020-06-19 08:33:52.700579
```

```dart
import 'package:ensemble_date/ensemble_date.dart';

const pattern = '\'Heute ist\' dd-MMMM-yyyy';
final n = DateTime.now();
final de_String = DateTime.now().format(pattern, 'de_DE');
Expand Down Expand Up @@ -74,7 +93,7 @@ Tomorrow: 2020-06-19 08:33:52.700579

## API

[Check full docs](https://pub.dev/documentation/dart_date/latest/)
[Check full docs](https://pub.dev/documentation/ensemble_date/latest/)

Date extension on DateTime

Expand Down
25 changes: 25 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
include: package:lints/recommended.yaml

analyzer:
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"

linter:
rules:
# Disable rules that conflict with existing code patterns
prefer_relative_imports: false
avoid_dynamic_calls: false
comment_references: false
constant_identifier_names: false
unnecessary_brace_in_string_interps: false

# Keep essential rules
avoid_slow_async_io: true
cancel_subscriptions: true
close_sinks: true
literal_only_boolean_expressions: true
no_adjacent_strings_in_list: true
test_types_in_equals: true
throw_in_finally: true
unnecessary_statements: true
2 changes: 1 addition & 1 deletion example/dart_date_example.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:dart_date/dart_date.dart';
import 'package:ensemble_date/ensemble_date.dart';

main(List<String> args) {
const pattern = '\'Heute ist\' dd-MMMM-yyyy';
Expand Down
3 changes: 0 additions & 3 deletions lib/dart_date.dart

This file was deleted.

4 changes: 4 additions & 0 deletions lib/ensemble_date.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/// Date manipulation library. DateTime extensions. Also includes an Interval object.
library ensemble_date;

export 'src/dart_date.dart';
32 changes: 24 additions & 8 deletions lib/src/dart_date.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ extension Date on DateTime {
/// Get [Date] object in LocalTime of current object.
DateTime get toLocalTime => toLocal();

/// Creates a new [DateTime] instance with the same value as this one
///
/// Returns an exact copy of this [DateTime] preserving the isUtc flag and all time components.
DateTime get clone => DateTime.fromMicrosecondsSinceEpoch(
microsecondsSinceEpoch,
isUtc: isUtc,
Expand Down Expand Up @@ -559,7 +562,12 @@ extension Date on DateTime {
static bool isDate(argument) => argument is DateTime;

/// Check if a date is [equals] to other
bool isEqual(other) => equals(other);
bool isEqual(dynamic other) {
if (other is DateTime) {
return equals(other);
}
return false;
}

/// Return true if this date day is monday
bool get isMonday => weekday == DateTime.monday;
Expand Down Expand Up @@ -923,27 +931,29 @@ extension Date on DateTime {
DateTime subDays(int amount) => addDays(-amount);

/// Subtracts an amout of milliseconds from this [DateTime]
DateTime subMilliseconds(amount) => addMilliseconds(-amount);
DateTime subMilliseconds(int amount) => addMilliseconds(-amount);

/// Subtracts an amout of microseconds from this [DateTime]
DateTime subMicroseconds(amount) => addMicroseconds(-amount);
DateTime subMicroseconds(int amount) => addMicroseconds(-amount);

// DateTime subISOYears(amount)
/// Subtracts an amout of minutes from this [DateTime]
DateTime subMinutes(amount) => addMinutes(-amount);
DateTime subMinutes(int amount) => addMinutes(-amount);

/// Subtracts an amout of months from this [DateTime]
DateTime subMonths(amount) => addMonths(-amount);
DateTime subMonths(int amount) => addMonths(-amount);

// DateTime subQuarters(amount)
/// Subtracts an amout of seconds from this [DateTime]
DateTime subSeconds(amount) => addSeconds(-amount);
DateTime subSeconds(int amount) => addSeconds(-amount);

// DateTime subWeeks(amount)
/// Subtracts an amout of years from this [DateTime]
DateTime subYears(amount) => addYears(-amount);
DateTime subYears(int amount) => addYears(-amount);

// Check if two dates are [equals]
/// Check if two dates are equal to each other
///
/// Returns true if this [DateTime] represents exactly the same moment in time as [other].
bool equals(DateTime other) => isAtSameMomentAs(other);

bool operator <(DateTime other) => isBefore(other);
Expand Down Expand Up @@ -1090,10 +1100,16 @@ extension Date on DateTime {
isUtc: false,
);

/// Subtract a [Duration] from this [DateTime]
///
/// Returns a new [DateTime] representing the moment that is [other] duration before this [DateTime].
DateTime operator -(Duration other) {
return this.subtract(other);
}

/// Add a [Duration] to this [DateTime]
///
/// Returns a new [DateTime] representing the moment that is [other] duration after this [DateTime].
DateTime operator +(Duration other) {
return add(other);
}
Expand Down
15 changes: 9 additions & 6 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
name: dart_date
description: Date manipulation library. DateTime extensions. Also includes an Interval object.
version: 1.1.1
homepage: https://github.com/xantiagoma/dart_date
name: ensemble_date
description: Date manipulation library. DateTime extensions. Also includes an Interval object. Forked from dart_date with additional improvements and maintenance.
version: 1.6.1
homepage: https://github.com/EnsembleUI/dart_date
repository: https://github.com/EnsembleUI/dart_date
issue_tracker: https://github.com/EnsembleUI/dart_date/issues

environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=2.12.0 <4.0.0'

dependencies:
intl: ">=0.18.1 <=0.19.0"
intl: ">=0.18.1 <0.21.0"
timeago: ^3.0.2

dev_dependencies:
test: ^1.16.0
lints: ^3.0.0
2 changes: 1 addition & 1 deletion test/dart_date_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:dart_date/dart_date.dart';
import 'package:ensemble_date/ensemble_date.dart';
import 'package:test/test.dart';

void main() {
Expand Down