-
Notifications
You must be signed in to change notification settings - Fork 152
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
Rename conversion methods to toFoo #705
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
3a142ec
polyfill: rename inTimeZone to toAbsolute and toDateTime
ryzokuken 1cb902d
spec: rename inTimeZone to toAbsolute and toDateTime
ryzokuken db2bf1b
docs: rename inTimeZone to toAbsolute and toDateTime
ryzokuken ad2b681
polyfill: rename withYear to toDate
ryzokuken 5a4e5e2
spec: rename withYear to toDate
ryzokuken a0d7ffc
docs: rename withYear to toDate
ryzokuken 90d0622
polyfill: rename withDay to toDate
ryzokuken d5dfcda
spec: rename withDay to toDate
ryzokuken 3845d04
docs: rename withDay to toDate
ryzokuken 343670c
polyfill: rename withDate to toDateTime
ryzokuken bca9bab
spec: rename withDate to toDateTime
ryzokuken 10670ab
docs: rename withDate to toDateTime
ryzokuken 4a2f459
polyfill: rename withTime to toDateTime
ryzokuken 6c381a3
spec: rename withTime to toDateTime
ryzokuken fb2a4d2
docs: rename withTime to toDateTime
ryzokuken 8994165
polyfill: rename getDate to toDate
ryzokuken b74ec46
spec: rename getDate to toDate
ryzokuken a3d99d3
docs: rename getDate to toDate
ryzokuken 2a793c5
polyfill: rename getTime to toTime
ryzokuken 2632945
spec: rename getTime to toTime
ryzokuken 8ad3a41
docs: rename getTime to toTime
ryzokuken 2d4cfb5
polyfill: rename getMonthDay to toMonthDay
ryzokuken 6e2e9d2
spec: rename getMonthDay to toMonthDay
ryzokuken bd4fe84
docs: rename getMonthDay to toMonthDay
ryzokuken a9ed785
polyfill: rename getYearMonth to toYearMonth
ryzokuken c231151
spec: rename getYearMonth to toYearMonth
ryzokuken e0a9d35
docs: rename getYearMonth to toYearMonth
ryzokuken 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 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 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 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 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 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 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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
*/ | ||
function getFirstTuesday(queriedMonth) { | ||
// We first need to convert to a date | ||
const firstOfMonth = queriedMonth.withDay(1); | ||
const firstOfMonth = queriedMonth.toDate(1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, maybe |
||
|
||
// We have Monday = 1, Sunday = 7, and we want to add a positive number | ||
// smaller than 7 to get to the first Tuesday. | ||
|
@@ -24,12 +24,12 @@ assert.equal(firstTuesdayOfMonth.toString(), '2020-02-04'); | |
assert.equal(firstTuesdayOfMonth.dayOfWeek, 2); | ||
|
||
// Similarly, to get the second Tuesday: | ||
const secondWeek = myMonth.withDay(8); | ||
const secondWeek = myMonth.toDate(8); | ||
const secondTuesday = secondWeek.plus({ days: [1, 0, 6, 5, 4, 3, 2][secondWeek.dayOfWeek - 1] }); | ||
assert.equal(secondTuesday.day, firstTuesdayOfMonth.day + 7); | ||
|
||
// And the last Tuesday: | ||
const lastOfMonth = myMonth.withDay(myMonth.daysInMonth); | ||
const lastOfMonth = myMonth.toDate(myMonth.daysInMonth); | ||
const lastTuesday = lastOfMonth.minus({ days: [6, 0, 1, 2, 3, 4, 5][lastOfMonth.dayOfWeek - 1] }); | ||
assert.equal(lastTuesday.toString(), '2020-02-25'); | ||
assert.equal(lastTuesday.dayOfWeek, 2); | ||
|
This file contains 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 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 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 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 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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const date = Temporal.Date.from('2020-05-14'); | ||
|
||
const noonOnDate = date.withTime(Temporal.Time.from({ hour: 12 })); | ||
const noonOnDate = date.toDateTime(Temporal.Time.from({ hour: 12 })); | ||
|
||
assert(noonOnDate instanceof Temporal.DateTime); | ||
assert.equal(noonOnDate.toString(), '2020-05-14T12:00'); |
This file contains 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 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, here is an example of where I really prefer the old names ...
toDate(year)
as below is OK, buttoDate(2030)
with a number literal is more mystifying to me. I know I was in the minority on that viewpoint so I definitely don't want to push for bringing the old names back; but maybe there is a third way? How about calling it toDateIn()? e.g.toDateIn(2030)
,toDateIn({ era: 'reiwa', year: 12 })