Skip to content

Commit

Permalink
Add New Zealand English (en-NZ) locale (#1835)
Browse files Browse the repository at this point in the history
  • Loading branch information
muntact committed Jul 17, 2020
1 parent cbc5fe8 commit ebb8b56
Show file tree
Hide file tree
Showing 8 changed files with 450 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/locale/en-NZ/_lib/formatLong/index.js
@@ -0,0 +1,41 @@
import buildFormatLongFn from '../../../_lib/buildFormatLongFn/index.js'

var dateFormats = {
full: 'EEEE, d MMMM yyyy',
long: 'd MMMM yyyy',
medium: 'd MMM yyyy',
short: 'dd/MM/yyyy'
}

var timeFormats = {
full: 'h:mm:ss a zzzz',
long: 'h:mm:ss a z',
medium: 'h:mm:ss a',
short: 'h:mm a'
}

var dateTimeFormats = {
full: "{{date}} 'at' {{time}}",
long: "{{date}} 'at' {{time}}",
medium: '{{date}}, {{time}}',
short: '{{date}}, {{time}}'
}

var formatLong = {
date: buildFormatLongFn({
formats: dateFormats,
defaultWidth: 'full'
}),

time: buildFormatLongFn({
formats: timeFormats,
defaultWidth: 'full'
}),

dateTime: buildFormatLongFn({
formats: dateTimeFormats,
defaultWidth: 'full'
})
}

export default formatLong
4 changes: 4 additions & 0 deletions src/locale/en-NZ/index.d.ts
@@ -0,0 +1,4 @@
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.

import { enNZ } from 'date-fns/locale'
export default enNZ
28 changes: 28 additions & 0 deletions src/locale/en-NZ/index.js
@@ -0,0 +1,28 @@
import formatDistance from '../en-US/_lib/formatDistance/index.js'
import formatLong from './_lib/formatLong/index.js'
import formatRelative from '../en-US/_lib/formatRelative/index.js'
import localize from '../en-US/_lib/localize/index.js'
import match from '../en-US/_lib/match/index.js'

/**
* @type {Locale}
* @category Locales
* @summary English locale (New Zealand).
* @language English
* @iso-639-2 eng
* @author Murray Lucas [@muntact]{@link https://github.com/muntact}
*/
var locale = {
code: 'en-NZ',
formatDistance: formatDistance,
formatLong: formatLong,
formatRelative: formatRelative,
localize: localize,
match: match,
options: {
weekStartsOn: 1 /* Monday */,
firstWeekContainsDate: 4
}
}

export default locale
35 changes: 35 additions & 0 deletions src/locale/en-NZ/index.js.flow
@@ -0,0 +1,35 @@
// @flow
// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.

export type Locale = {
code?: string,
formatDistance?: (...args: Array<any>) => any,
formatRelative?: (...args: Array<any>) => any,
localize?: {
ordinalNumber: (...args: Array<any>) => any,
era: (...args: Array<any>) => any,
quarter: (...args: Array<any>) => any,
month: (...args: Array<any>) => any,
day: (...args: Array<any>) => any,
dayPeriod: (...args: Array<any>) => any
},
formatLong?: {
date: (...args: Array<any>) => any,
time: (...args: Array<any>) => any,
dateTime: (...args: Array<any>) => any
},
match?: {
ordinalNumber: (...args: Array<any>) => any,
era: (...args: Array<any>) => any,
quarter: (...args: Array<any>) => any,
month: (...args: Array<any>) => any,
day: (...args: Array<any>) => any,
dayPeriod: (...args: Array<any>) => any
},
options?: {
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7
}
}

declare module.exports: Locale
304 changes: 304 additions & 0 deletions src/locale/en-NZ/snapshot.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/locale/index.js
Expand Up @@ -18,6 +18,7 @@ export { default as enAU } from './en-AU/index.js'
export { default as enCA } from './en-CA/index.js'
export { default as enGB } from './en-GB/index.js'
export { default as enIN } from './en-IN/index.js'
export { default as enNZ } from './en-NZ/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'
Expand Down
1 change: 1 addition & 0 deletions src/locale/index.js.flow
Expand Up @@ -52,6 +52,7 @@ declare module.exports: {
enCA: Locale,
enGB: Locale,
enIN: Locale,
enNZ: Locale,
enUS: Locale,
eo: Locale,
es: Locale,
Expand Down
36 changes: 36 additions & 0 deletions typings.d.ts
Expand Up @@ -15739,6 +15739,9 @@ declare module 'date-fns/locale' {
const enIN: Locale
namespace enIN {}

const enNZ: Locale
namespace enNZ {}

const enUS: Locale
namespace enUS {}

Expand Down Expand Up @@ -16003,6 +16006,11 @@ declare module 'date-fns/locale/en-IN' {
export default enIN
}

declare module 'date-fns/locale/en-NZ' {
import { enNZ } from 'date-fns/locale'
export default enNZ
}

declare module 'date-fns/locale/en-US' {
import { enUS } from 'date-fns/locale'
export default enUS
Expand Down Expand Up @@ -16378,6 +16386,11 @@ declare module 'date-fns/locale/en-IN/index' {
export default enIN
}

declare module 'date-fns/locale/en-NZ/index' {
import { enNZ } from 'date-fns/locale'
export default enNZ
}

declare module 'date-fns/locale/en-US/index' {
import { enUS } from 'date-fns/locale'
export default enUS
Expand Down Expand Up @@ -16753,6 +16766,11 @@ declare module 'date-fns/locale/en-IN/index.js' {
export default enIN
}

declare module 'date-fns/locale/en-NZ/index.js' {
import { enNZ } from 'date-fns/locale'
export default enNZ
}

declare module 'date-fns/locale/en-US/index.js' {
import { enUS } from 'date-fns/locale'
export default enUS
Expand Down Expand Up @@ -17093,6 +17111,9 @@ declare module 'date-fns/esm/locale' {
const enIN: Locale
namespace enIN {}

const enNZ: Locale
namespace enNZ {}

const enUS: Locale
namespace enUS {}

Expand Down Expand Up @@ -17357,6 +17378,11 @@ declare module 'date-fns/esm/locale/en-IN' {
export default enIN
}

declare module 'date-fns/esm/locale/en-NZ' {
import { enNZ } from 'date-fns/esm/locale'
export default enNZ
}

declare module 'date-fns/esm/locale/en-US' {
import { enUS } from 'date-fns/esm/locale'
export default enUS
Expand Down Expand Up @@ -17732,6 +17758,11 @@ declare module 'date-fns/esm/locale/en-IN/index' {
export default enIN
}

declare module 'date-fns/esm/locale/en-NZ/index' {
import { enNZ } from 'date-fns/esm/locale'
export default enNZ
}

declare module 'date-fns/esm/locale/en-US/index' {
import { enUS } from 'date-fns/esm/locale'
export default enUS
Expand Down Expand Up @@ -18107,6 +18138,11 @@ declare module 'date-fns/esm/locale/en-IN/index.js' {
export default enIN
}

declare module 'date-fns/esm/locale/en-NZ/index.js' {
import { enNZ } from 'date-fns/esm/locale'
export default enNZ
}

declare module 'date-fns/esm/locale/en-US/index.js' {
import { enUS } from 'date-fns/esm/locale'
export default enUS
Expand Down

0 comments on commit ebb8b56

Please sign in to comment.