[go: nahoru, domu]

Skip to content
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

[stdlib] Improve the Time library for Luna #59

Merged
merged 6 commits into from
Jan 14, 2018
Merged

Conversation

piotrMocz
Copy link
  • More time intervals (hour, day, week, even fortnight)
  • Methods {beginning, end}Of{Day, Month, Year}
  • Some utility methods for accessing the year/month/day part of the datetime
  • Tiny refactoring of the types as used by the Std.hs file, just for (my) convenience.

NOTE: I decided to do the timezone support as a separate PR, this is big enough.

## Returns a TimeInterval with the length of `self` days.
def days: self*24 . hours
## Returns a TimeInterval with the length of `self` weeks.
def days: self*7 . days
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This recursion never ends.

## Returns a TimeInterval with the length of `self` fortnights.
def fortnights: self*2 . weeks
## An alias for `miliseconds`
def milisecond: self.miliseconds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the singulars, this is too much

## Returns a TimeInterval with the length of `self` weeks.
def days: self*7 . days
## Returns a TimeInterval with the length of `self` fortnights.
def fortnights: self*2 . weeks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fortnight is not that useful. But a month or a year would be much more welcome :)

@piotrMocz
Copy link
Author
piotrMocz commented Jan 13, 2018

Ooops, why did I merge and not rebase ;( Ha, fixed! 🥇


def midnight: TimeOfDayVal 0 0 0.0

def midday: TimeOfDayVal 12 0 0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noon?

@piotrMocz
Copy link
Author

@kustosz I removed the tests, because it turned out they made little sense. But fixed all the errors I encountered along the way. I think I'll merge this one and open a new one to create some tests.

@piotrMocz piotrMocz merged commit a17286d into master Jan 14, 2018
@piotrMocz piotrMocz deleted the time-improvements branch January 14, 2018 16:27
iamrecursion pushed a commit that referenced this pull request Aug 10, 2018
turion pushed a commit to turion/luna that referenced this pull request Jun 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants