Skip to content

Commit

Permalink
feat: add toDate
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed Nov 1, 2018
1 parent 6adc410 commit c8591c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as Disposer } from './Disposer'
export { default as base64Decode } from './base64Decode'
export { default as base64Encode } from './base64Encode'
export { default as base64UrlDecode } from './base64UrlDecode'
Expand All @@ -7,7 +8,6 @@ export { default as castArray } from './castArray'
export { default as clamp } from './clamp'
export { default as cssTransform } from './cssTransform'
export { default as currencyFormat } from './currencyFormat'
export { default as Disposer } from './Disposer'
export { default as fill } from './fill'
export { default as forOwn } from './forOwn'
export { default as getType } from './getType'
Expand Down Expand Up @@ -48,5 +48,6 @@ export { default as shuffle } from './shuffle'
export { default as stopEventPropagation } from './stopEventPropagation'
export { default as storage } from './storage'
export { default as supportPassiveEventListener } from './supportPassiveEventListener'
export { default as toDate } from './toDate'
export { default as upperCaseFirst } from './upperCaseFirst'
export { default as values } from './values'
11 changes: 11 additions & 0 deletions src/toDate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { toDate as valueToDate } from 'date-fns'

/**
* 将 `value` 转换为 `Date` 实例。
*
* @param value 要转换的时间
* @returns 转换后的 `Date` 实例
*/
export default function toDate(value: string | number | Date): Date {
return valueToDate(value)
}

0 comments on commit c8591c4

Please sign in to comment.