Skip to content

Commit

Permalink
Bump version v9.2.1 - documentation change only
Browse files Browse the repository at this point in the history
doc(Period,Duration): improve
- Explain Duration and Period better as to there difference. Fix an error in the doc for Duration as well.
- Add warning in README.md to indicate that Duration and Period are reversed in date-elm-extra in meaning compared to nodatime, this is purely due to me mixing them up with out realising it, I have not yet figured out if I should swap the concepts around in elm-date-extra or not at the moment.
  • Loading branch information
rluiten committed Nov 13, 2017
1 parent e9f5f94 commit a340016
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Date Extra Package


# WARNING!

I have discovered that I managed to copy concepts from NodaTimes Period concept to Duration and there Duration concept to Period I got it backwards. Which I am sure is not helping anyone with back ground in nodatime doing the right thing with elm-date-extra.

* I am not sure if i should swap them in elm-date-extra so they match the NodaTime terms at the moment.

### Introduction

An Elm language package for working with dates and times.


See bottom of this document for important history notes.

### Code format
Expand Down
2 changes: 1 addition & 1 deletion elm-package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "9.2.0",
"version": "9.2.1",
"summary": "Date Extra library add/subtract/diff/format etc dates.",
"repository": "https://github.com/rluiten/elm-date-extra.git",
"license": "BSD3",
Expand Down
9 changes: 8 additions & 1 deletion src/Date/Extra/Duration.elm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ module Date.Extra.Duration
{-| A Duration is a length of time that may vary with calendar date
and time. It can be used to modify a date.
Represents a period of time expressed in human chronological terms
in terms of a calendar which may have varying components based upon
the dates involved in the math.
When modify dates using Durations (Day | Month | Week | Year) this module
compensates for day light saving hour variations to minimise the scenarios
that cause the Hour field in the result to be different to the input date.
Expand Down Expand Up @@ -303,7 +307,10 @@ addYear yearCount date =
{-| Return a Period representing date difference. date1 - date2.
If you add the result of this function to date2 with addend of 1
will return date1.
will not always return date1, this is because this module supports
human calendar concepts liek Day Light Saving, Months with varying
number of days dependent on the month and leap years. So the difference
between two dates is dependent on when those dates are.
**Differences to Period.diff**
Expand Down
28 changes: 15 additions & 13 deletions src/Date/Extra/Period.elm
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
module Date.Extra.Period
exposing
( add
, DeltaRecord
, diff
( DeltaRecord
, Period(..)
, add
, diff
, toTicks
, zeroDelta
)

{-| Period is a fixed length of time. It is an elapsed time concept, which
does not include the concept of Years Months or Daylight saving variations.
- Represents a fixed (and calendar-independent) length of time.
Name of type concept copied from NodaTime.
@docs add
Expand Down Expand Up @@ -162,18 +164,18 @@ diff date1 date2 =
absDayDiff =
abs onlyDaysDiff
in
( negate (absDayDiff // 7)
, negate (absDayDiff % 7)
)
( negate (absDayDiff // 7)
, negate (absDayDiff % 7)
)
else
( onlyDaysDiff // 7
, onlyDaysDiff % 7
)
in
{ week = weekDiff
, day = dayDiff
, hour = hourDiff
, minute = minuteDiff
, second = secondDiff
, millisecond = millisecondDiff
}
{ week = weekDiff
, day = dayDiff
, hour = hourDiff
, minute = minuteDiff
, second = secondDiff
, millisecond = millisecondDiff
}

0 comments on commit a340016

Please sign in to comment.