Giter VIP home page Giter VIP logo

daylight's People

Contributors

blkkkbvsik avatar dependabot[bot] avatar dmoeyers avatar jankolancer avatar krohnmi avatar renancaraujo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

daylight's Issues

Civil sunrise and sunset off by 30 mins

Hello,

Thanks for a very useful library.

I have found that the calculated date time is off by 30 mins and hence we need to add this to get the correct value after calculation. Here's what I ended up writing:

  SunTime _fromLibrary2({DateTime dateTime}) {
    //uses this package: daylight
    berlin();

    //const lc = const DaylightLocation(52.518611, 13.408056);
    final lc = DaylightLocation(latitude, longitude);

    // Create lc calculator
    final lcCalculator = DaylightCalculator(lc);

    //this is the closest, but still early by 30 mins
    final daylightResult =
        lcCalculator.calculateForDay(dateTime ?? DateTime.now());

    //correct the difference of 30 mins
    return new SunTime(
        daylightResult.sunrise.round().add(Duration(minutes: 30)),
        daylightResult.sunset.round().add(Duration(minutes: 30)));
  }

/// Result of SunriseSunset calculation
class SunTime {
  /// Construnctor method
  SunTime(this.sunrise, this.sunset);

  /// Time of the sunrise
  DateTime sunrise;

  /// Time of the sunset
  DateTime sunset;

  String localSunriseDisplay() =>
      '${sunrise.toLocal().hour}:${sunrise.toLocal().minute}';
  String localSunsetDisplay() =>
      '${sunset.toLocal().hour}:${sunset.toLocal().minute}';

  @override
  String toString() =>
      'Sunrise: $localSunriseDisplay, Sunset: $localSunsetDisplay';
}

extension Round on DateTime {
  DateTime round({roundAtSeconds = 30}) {
    var factor =
        this.second <= roundAtSeconds ? (-1 * this.second) : (60 - this.second);
    return this.add(Duration(seconds: factor));
  }
}

Can you please confirm if this is so. And if the issue is correct, kindly update the package.

Does not properly calculate events

Have tried using package with very basic implementation, but is seems always gets data wrong to 3 hours. I think it doesn't calculate UTC + hours. Do i need to do it myself and if so, how better achieve this?

update intl

Because daylight 2.0.0 depends on intl ^0.17.0 and no versions of daylight match >2.0.0 <3.0.0, daylight ^2.0.0 requires intl ^0.17.0.
So, because XXX depends on both intl ^0.18.0 and daylight ^2.0.0, version solving failed.

Results offset when using a DateTime that is utc as input

When using calculateEvent or calculateForDay of the DaylightCalculator and using an input DateTime which already is UTC, the results are offset from the correct time by the difference between local and utc.

You should be able to easily reproduce this problem by using, e.g. final todayUtc = DateTime.utc(2020, 1, 19) as the input.

Sunrise time difference

version: 1.0.0

I compare a time in sunrise-sunset API with your package.
In sunset in the same time in my location (39.4699014, -0.3759513), day 2020-03-03 and Zennit default (official).
But in sunrise, have a litle difference of 56 seconds . This is a screenshots and values
API - Sunrise 07:29:48:
image
Package - Sunrise 07:30:44:
image

OBS: This is a minor issue and I'll use this package because is awesome :)

please migrate the package to intl 0.17.0

I am using day package in my app and now after upgrading to latest flutter sdk i am unable to use the day light package.
error message I get is the following.

Because no versions of daylight match >0.2.0 <0.3.0 and daylight 0.2.0 depends on intl ^0.16.1, daylight ^0.2.0 requires intl ^0.16.1.
And because every version of flutter_localizations from sdk depends on intl 0.17.0, daylight ^0.2.0 is incompatible with flutter_localizations from sdk.
So, because tiremoni depends on both flutter_localizations any from sdk and daylight ^0.2.0, version solving failed.
pub get failed (1; So, because tiremoni depends on both flutter_localizations any from sdk and daylight ^0.2.0, version solving failed.)

Need update dependencies

Because daylight 2.0.0 depends on intl ^0.17.0 and no versions of daylight match >2.0.0 <3.0.0, daylight ^2.0.0 requires intl ^0.17.0.
So, because XXX depends on both intl ^0.18.0 and daylight ^2.0.0, version solving failed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.