Skip to content

Commit

Permalink
Add new function fromUnixTime
Browse files Browse the repository at this point in the history
  • Loading branch information
xkizer committed Oct 18, 2018
1 parent 32283c6 commit 16254b6
Show file tree
Hide file tree
Showing 21 changed files with 1,821 additions and 986 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ for the list of changes made since `v2.0.0-alpha.1`.

- [New `roundToNearestMinutes` function](https://github.com/date-fns/date-fns/pull/928). Kudos to [@xkizer](https://github.com/xkizer).

- Added new function `fromUnixTime`

### Changed

- **BREAKING**: new format string API for `format` function
Expand Down
858 changes: 560 additions & 298 deletions src/esm/fp/index.js

Large diffs are not rendered by default.

329 changes: 180 additions & 149 deletions src/esm/index.js

Large diffs are not rendered by default.

49 changes: 25 additions & 24 deletions src/esm/locale/index.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
// This file is generated automatically by `scripts/build/indices.js`. Please, don't change it.

export {default as af} from './af/index.js'
export {default as bn} from './bn/index.js'
export {default as de} from './de/index.js'
export {default as enCA} from './en-CA/index.js'
export {default as enGB} from './en-GB/index.js'
export {default as enUS} from './en-US/index.js'
export {default as eo} from './eo/index.js'
export {default as es} from './es/index.js'
export {default as et} from './et/index.js'
export {default as fr} from './fr/index.js'
export {default as gl} from './gl/index.js'
export {default as he} from './he/index.js'
export {default as hu} from './hu/index.js'
export {default as it} from './it/index.js'
export {default as ja} from './ja/index.js'
export {default as lt} from './lt/index.js'
export {default as nb} from './nb/index.js'
export {default as nl} from './nl/index.js'
export {default as ptBR} from './pt-BR/index.js'
export {default as ru} from './ru/index.js'
export {default as sv} from './sv/index.js'
export {default as uk} from './uk/index.js'
export {default as vi} from './vi/index.js'
export {default as zhCN} from './zh-CN/index.js'
export { default as af } from './af/index.js'
export { default as bn } from './bn/index.js'
export { default as de } from './de/index.js'
export { default as el } from './el/index.js'
export { default as enCA } from './en-CA/index.js'
export { default as enGB } from './en-GB/index.js'
export { default as enUS } from './en-US/index.js'
export { default as eo } from './eo/index.js'
export { default as es } from './es/index.js'
export { default as et } from './et/index.js'
export { default as fr } from './fr/index.js'
export { default as gl } from './gl/index.js'
export { default as he } from './he/index.js'
export { default as hu } from './hu/index.js'
export { default as it } from './it/index.js'
export { default as ja } from './ja/index.js'
export { default as lt } from './lt/index.js'
export { default as nb } from './nb/index.js'
export { default as nl } from './nl/index.js'
export { default as ptBR } from './pt-BR/index.js'
export { default as ru } from './ru/index.js'
export { default as sv } from './sv/index.js'
export { default as uk } from './uk/index.js'
export { default as vi } from './vi/index.js'
export { default as zhCN } from './zh-CN/index.js'
4 changes: 4 additions & 0 deletions src/fp/fromUnixTime/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.

import {fromUnixTime} from 'date-fns/fp'
export = fromUnixTime
8 changes: 8 additions & 0 deletions src/fp/fromUnixTime/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.

import fn from '../../fromUnixTime/index.js'
import convertToFP from '../_lib/convertToFP/index.js'

var fromUnixTime = convertToFP(fn, 1)

export default fromUnixTime
52 changes: 52 additions & 0 deletions src/fp/fromUnixTime/index.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.

type Interval = {
start: Date | string | number,
end: Date | string | number
}

type Options = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean
}

type Locale = {
formatDistance: Function,
formatRelative: Function,
localize: {
ordinalNumber: Function,
era: Function,
quarter: Function,
month: Function,
day: Function,
dayPeriod: Function
},
formatLong: Object,
date: Function,
time: Function,
dateTime: Function,
match: {
ordinalNumber: Function,
era: Function,
quarter: Function,
month: Function,
day: Function,
dayPeriod: Function
},
options?: {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7
}
}

type CurriedFn1<A, R> = <A>(a: A) => R

declare module.exports: CurriedFn1<number, Date>
4 changes: 4 additions & 0 deletions src/fp/fromUnixTimeWithOptions/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.

import {fromUnixTimeWithOptions} from 'date-fns/fp'
export = fromUnixTimeWithOptions
8 changes: 8 additions & 0 deletions src/fp/fromUnixTimeWithOptions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.

import fn from '../../fromUnixTime/index.js'
import convertToFP from '../_lib/convertToFP/index.js'

var fromUnixTimeWithOptions = convertToFP(fn, 2)

export default fromUnixTimeWithOptions
55 changes: 55 additions & 0 deletions src/fp/fromUnixTimeWithOptions/index.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.

type Interval = {
start: Date | string | number,
end: Date | string | number
}

type Options = {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
additionalDigits?: 0 | 1 | 2,
locale?: Locale,
includeSeconds?: boolean,
addSuffix?: boolean,
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
roundingMethod?: 'floor' | 'ceil' | 'round',
awareOfUnicodeTokens?: boolean
}

type Locale = {
formatDistance: Function,
formatRelative: Function,
localize: {
ordinalNumber: Function,
era: Function,
quarter: Function,
month: Function,
day: Function,
dayPeriod: Function
},
formatLong: Object,
date: Function,
time: Function,
dateTime: Function,
match: {
ordinalNumber: Function,
era: Function,
quarter: Function,
month: Function,
day: Function,
dayPeriod: Function
},
options?: {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7
}
}

type CurriedFn1<A, R> = <A>(a: A) => R

type CurriedFn2<A, B, R> = <A>(a: A) => CurriedFn1<B, R>
| <A, B>(a: A, b: B) => R

declare module.exports: CurriedFn2<Options, number, Date>
2 changes: 2 additions & 0 deletions src/fp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ module.exports = {
formatRelative: require('./formatRelative/index.js'),
formatRelativeWithOptions: require('./formatRelativeWithOptions/index.js'),
formatWithOptions: require('./formatWithOptions/index.js'),
fromUnixTime: require('./fromUnixTime/index.js'),
fromUnixTimeWithOptions: require('./fromUnixTimeWithOptions/index.js'),
getDate: require('./getDate/index.js'),
getDateWithOptions: require('./getDateWithOptions/index.js'),
getDay: require('./getDay/index.js'),
Expand Down
2 changes: 2 additions & 0 deletions src/fp/index.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ declare module.exports: {
formatRelative: CurriedFn2<Date | string | number, Date | string | number, string>,
formatRelativeWithOptions: CurriedFn3<Options, Date | string | number, Date | string | number, string>,
formatWithOptions: CurriedFn3<Options, string, Date | string | number, string>,
fromUnixTime: CurriedFn1<number, Date>,
fromUnixTimeWithOptions: CurriedFn2<Options, number, Date>,
getDate: CurriedFn1<Date | string | number, number>,
getDateWithOptions: CurriedFn2<Options, Date | string | number, number>,
getDay: CurriedFn1<Date | string | number, number>,
Expand Down

0 comments on commit 16254b6

Please sign in to comment.