Skip to content

Commit

Permalink
chore: rename plugin LocalizableFormat to LocalizedFormat (#471)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkun authored Feb 2, 2019
1 parent 7287cdb commit 1e185b5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/en/API-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ dayjs('2019-01-25').format('DD/MM/YYYY'); // '25/01/2019'
| `a` | am pm | |

* More available formats `Q Do k kk X x ...` in plugin [`AdvancedFormat`](./Plugin.md#advancedformat)
* Localizable format options compatioble with Moment.js `L LT LTS ...` in plugin [`LocalizableFormat`](./Plugin.md#localizableFormat)
* Localized format options `L LT LTS ...` in plugin [`LocalizedFormat`](./Plugin.md#localizedFormat)

### Difference `.diff(compared: Dayjs, unit: string (default: 'milliseconds'), float?: boolean)`

Expand Down
8 changes: 4 additions & 4 deletions docs/en/Plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ List of added formats:
| `X` | 1360013296 | Unix Timestamp in second |
| `x` | 1360013296123 | Unix Timestamp in millisecond |

### LocalizableFormat
- LocalizableFormat extends `dayjs().format` API to supply localizable format options known from Moment.js.
### LocalizedFormat
- LocalizedFormat extends `dayjs().format` API to supply localized format options known from Moment.js.

```javascript
import localizableFormat from 'dayjs/plugin/localizableFormat'
import LocalizedFormat from 'dayjs/plugin/localizedFormat'

dayjs.extend(localizableFormat)
dayjs.extend(LocalizedFormat)

dayjs().format('L LT')
```
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions test/plugin/localizableFormat.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import moment from 'moment'
import dayjs from '../../src'
import es from '../../src/locale/es'
import ar from '../../src/locale/ar'
import localizableFormat from '../../src/plugin/localizableFormat'
import localizedFormat from '../../src/plugin/localizedFormat'

dayjs.extend(localizableFormat)
dayjs.extend(localizedFormat)

beforeEach(() => {
MockDate.set(new Date())
Expand All @@ -15,14 +15,14 @@ afterEach(() => {
MockDate.reset()
})

it('Declares English localizable formats', () => {
it('Declares English localized formats', () => {
expect(dayjs.en).toBeDefined()
expect(dayjs.en.formats).toBeDefined();
['LT', 'LTS', 'L', 'LL', 'LLL', 'LLLL'].forEach(option =>
expect(dayjs.en.formats[option]).toBeDefined())
})

it('Recognizes localizable format options', () => {
it('Recognizes localized format options', () => {
const { formats } = dayjs.en
const date = dayjs();
['LT', 'LTS', 'L', 'LL', 'LLL', 'LLLL'].forEach(option =>
Expand Down

0 comments on commit 1e185b5

Please sign in to comment.