-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Implement Duration and shift/2 for calendar types #13385
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
Merged
Merged
Changes from all commits
Commits
Show all changes
97 commits
Select commit
Hold shift + click to select a range
2ea8b44
Date.shift/2 for ISO dates
tfiedlerdejanze df03f59
do not order shift options
tfiedlerdejanze 209dc13
use calendar.days_in_month/2
tfiedlerdejanze d1e09e4
cleanup last day of month
tfiedlerdejanze e275c4b
return tuple from Date.shift/2
tfiedlerdejanze a07b738
implement Calendar.ISO.shift_date/4 Calendar callback
tfiedlerdejanze 8c1ff22
handle complex shifts around negative years
tfiedlerdejanze 34803b9
more tests
tfiedlerdejanze f69cf9d
Introduce bare Calendar.Duration
tfiedlerdejanze cf41c66
build shift options from Duration.t() in calendar
tfiedlerdejanze 54c15b7
cleanup iso shift helpers
tfiedlerdejanze 489b18c
collapse duration time units to months, seconds and microseconds
tfiedlerdejanze c91f3b6
specs + iso function order
tfiedlerdejanze b5aaa40
separate shift_date/4 and shift_naive_datetime/8 implementations
tfiedlerdejanze 4580d21
add tests
tfiedlerdejanze d81a809
add sigil_P
tfiedlerdejanze d1b9323
gracefully handle invalid duration args
tfiedlerdejanze 2d5b067
add Time.shift/2
tfiedlerdejanze 27e02fd
variable name
tfiedlerdejanze ce16ad3
add DateTime.shift/2
tfiedlerdejanze 287c8af
add sigil variant to all examples
tfiedlerdejanze 063a33c
cleanup specs
tfiedlerdejanze 8c1e536
more typespecs
tfiedlerdejanze c6ab2ee
drop sigil_P
tfiedlerdejanze 7ead281
add initial Calendar.Duration api
tfiedlerdejanze 39e3d5d
align examples in Date module
tfiedlerdejanze 1d17efe
slightly less verbose shift_time_unit/3
tfiedlerdejanze a9aa6b1
Calendar.Duration -> Duration
tfiedlerdejanze 0566438
flatten shift_naive_datetime iso test
tfiedlerdejanze 7852620
consistent style in duration.ex
tfiedlerdejanze 92bc5ef
add more duration public functions
tfiedlerdejanze c24286b
comparison rounds to second
tfiedlerdejanze be1fcd6
add calendar callbacks for Duration.to_seconds/1 and Duration.from_se…
tfiedlerdejanze f8844a4
consider microseconds in Duration.compare/2
tfiedlerdejanze 3b302f5
drop duration utility functions
tfiedlerdejanze 64f8af3
let shift functions raise when called with invalid units
tfiedlerdejanze f78d99d
prevent shifting date by time units
tfiedlerdejanze f008f70
prevent shifting time by date units
tfiedlerdejanze bf0fbc2
spec invalid keys
tfiedlerdejanze 75bcb42
support millisecond in Duration
tfiedlerdejanze 65d6ee5
Duration.invalid_keys/2 -> Duration.invalid_units/2
tfiedlerdejanze 586f4a4
consistent calendar microsecond format in duration
tfiedlerdejanze efbcc38
cleanup
tfiedlerdejanze c8e75a5
validate date and time fields Calendar.ISO
tfiedlerdejanze 210e2b9
cleanup
tfiedlerdejanze 28e5e03
cleanup
tfiedlerdejanze 3121fa4
from_naive/4 in DateTime.shift/3
tfiedlerdejanze f4be40c
cleanup shift options validation
tfiedlerdejanze 2fd6528
since doc annotations
tfiedlerdejanze af047e6
improve docs
tfiedlerdejanze bcacd15
dont pattern match on input struct type
tfiedlerdejanze 1d24815
more docs
tfiedlerdejanze 28b3b68
add convenience wrapper shift!/2 to all calendar types
tfiedlerdejanze 7027e7f
docs
tfiedlerdejanze 73c1151
quote functions
tfiedlerdejanze 1bf41fd
consolidate Date.add/2 and Time.add/3
tfiedlerdejanze 4b0a2bc
Revert "consolidate Date.add/2 and Time.add/3"
tfiedlerdejanze d6243f1
correct shift docs
tfiedlerdejanze 715403a
noop implementation to test calendar callback
tfiedlerdejanze dadba31
raise instead of noop in Calendar.Holocene date shift test
tfiedlerdejanze 5952c17
docs
tfiedlerdejanze 7167711
doc structure
tfiedlerdejanze 45b208c
docs
tfiedlerdejanze 4536554
datetime shift time zone docs
tfiedlerdejanze a6fcc6e
test Calendar.ISO.shift_time/5
tfiedlerdejanze 7adf6fc
drop redundant clause in shift_months/2
tfiedlerdejanze b5142cd
consistent annotation
tfiedlerdejanze 1696f3c
concise hint on add/2
tfiedlerdejanze 86f088b
DateTime.shift/3 as coordinated universal time
tfiedlerdejanze c8e904a
specs
tfiedlerdejanze 1200e27
apply offset after wall clock shift
tfiedlerdejanze c0b4217
respect duration precision in DateTime.shift/3
tfiedlerdejanze ebf48b1
return calendar type instead of tuple
tfiedlerdejanze f522fd9
docs
tfiedlerdejanze 6337efa
separate DateTime.shift/3 clause for UTC
tfiedlerdejanze 9ba2a04
actually test PDT and PST
tfiedlerdejanze 4867289
DateTime.shift/3 docs
tfiedlerdejanze d3cee29
correct "since" annotations
tfiedlerdejanze e4d74fa
ensure two-element tuple for Duration.new/1 microsecond
tfiedlerdejanze 6641b4d
validate all duration units in Duration.new/1
tfiedlerdejanze 8f4fd81
keep validation simple
tfiedlerdejanze d2a016b
cleanup Duration.new/1 validation
tfiedlerdejanze 8799b15
cleanup datetime test
tfiedlerdejanze 3d148dd
leaner docs
tfiedlerdejanze b771016
duration validation
tfiedlerdejanze 5e9d6fb
add examples for DateTime.shift/3
tfiedlerdejanze d605e0f
add more examples to Duration
tfiedlerdejanze 0f8957e
add leap year examples to Date and NaiveDateTime
tfiedlerdejanze bbce345
quote KeyError in docs
tfiedlerdejanze 92b5eac
consistent note on shift in add docs
tfiedlerdejanze 454f054
consolidate shift docs to mention the default calendar
tfiedlerdejanze 3e02be7
improve docs for DateTime.shift/3
tfiedlerdejanze 7ecbc48
add shift examples with negative duration units
tfiedlerdejanze 8f9c1f4
rename Duration.unit type to Duration.unit_pair
tfiedlerdejanze 14b1314
document rounding behaviour when shifting by month
tfiedlerdejanze 369f953
rename Duration.new/1 to Duration.new!/1
tfiedlerdejanze f69baf1
inspect only non-default values on %Duration{}
tfiedlerdejanze File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.