-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Move toObject, toArray API to separate plugin from core
- Loading branch information
Showing
6 changed files
with
60 additions
and
38 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export default (o, c) => { | ||
const proto = c.prototype | ||
proto.toArray = function () { | ||
return [ | ||
this.$y, | ||
this.$M, | ||
this.$D, | ||
this.$H, | ||
this.$m, | ||
this.$s, | ||
this.$ms | ||
] | ||
} | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export default (o, c) => { | ||
const proto = c.prototype | ||
proto.toObject = function () { | ||
return { | ||
years: this.$y, | ||
months: this.$M, | ||
date: this.$D, | ||
hours: this.$H, | ||
minutes: this.$m, | ||
seconds: this.$s, | ||
milliseconds: this.$ms | ||
} | ||
} | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { PluginFunc } from 'dayjs' | ||
|
||
declare const plugin: PluginFunc | ||
export = plugin | ||
|
||
declare module 'dayjs' { | ||
interface Dayjs { | ||
toArray(): number[] | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { PluginFunc } from 'dayjs' | ||
|
||
declare const plugin: PluginFunc | ||
export = plugin | ||
|
||
interface DayjsObject { | ||
years: number | ||
months: number | ||
date: number | ||
hours: number | ||
minutes: number | ||
seconds: number | ||
milliseconds: number | ||
} | ||
|
||
declare module 'dayjs' { | ||
interface Dayjs { | ||
toObject(): DayjsObject | ||
} | ||
} |
40a3431
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.
have you guys not heard of semantic versioning? why does a breaking change like this come up in a minor (aka bugfix) version change? npm/yarn happily upgrade those versions automatically
40a3431
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.
@JosuaKrause Sorry. That's my fault.
This package is released by an auto semantic-release based on git commit message.
After v1.8.10 released, I found this should be a minor update instead of a patch. However, it's too late to unpublish this on npm due to their restriction.