-
-
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.
Merge pull request #863 from iamkun/dev
D2M
- Loading branch information
Showing
32 changed files
with
888 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ | |
], | ||
"import/extensions": [ | ||
2, | ||
"ignorePackages" | ||
"never" | ||
] | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
# IDE | ||
.idea | ||
.vscode | ||
|
||
# npm | ||
node_modules | ||
|
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ cache: | |
- ~/.npm | ||
- node_modules | ||
node_js: | ||
- '12' | ||
- '10' | ||
- '8' | ||
- '6' | ||
|
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,124 @@ | ||
<p align="center"><a href="#" target="_blank" rel="noopener noreferrer"><img width="550" | ||
src="https://user-images.githubusercontent.com/17680888/39081119-3057bbe2-456e-11e8-862c-646133ad4b43.png" | ||
alt="Day.js"></a></p> | ||
<p align="center">Быстрая <b>2kB</b> альтернатива Moment.js с тем же современным API</p> | ||
<br> | ||
<p align="center"> | ||
<a href="https://unpkg.com/dayjs/dayjs.min.js"><img | ||
src="http://img.badgesize.io/https://unpkg.com/dayjs/dayjs.min.js?compression=gzip&style=flat-square" | ||
alt="Gzip Size"></a> | ||
<a href="https://www.npmjs.com/package/dayjs"><img src="https://img.shields.io/npm/v/dayjs.svg?style=flat-square&colorB=51C838" | ||
alt="NPM Version"></a> | ||
<a href="https://travis-ci.org/iamkun/dayjs"><img | ||
src="https://img.shields.io/travis/iamkun/dayjs/master.svg?style=flat-square" alt="Build Status"></a> | ||
<a href="https://codecov.io/gh/iamkun/dayjs"><img | ||
src="https://img.shields.io/codecov/c/github/iamkun/dayjs/master.svg?style=flat-square" alt="Codecov"></a> | ||
<a href="https://github.com/iamkun/dayjs/blob/master/LICENSE"><img | ||
src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square" alt="License"></a> | ||
<br> | ||
<a href="https://saucelabs.com/u/dayjs"> | ||
<img width="750" src="https://user-images.githubusercontent.com/17680888/40040137-8e3323a6-584b-11e8-9dba-bbe577ee8a7b.png" alt="Sauce Test Status"> | ||
</a> | ||
</p> | ||
|
||
> Day.js - это миниатюрная JavaScript библиотека, которая анализирует, валидирует, манипулирует, и отображает даты и время для современных браузеров, также обладает внушительной совместимостью с Moment.js API. Если вы используете Moment.js, тогда вы уже знаете как пользоваться Day.js. | ||
```js | ||
dayjs().startOf('month').add(1, 'day').set('year', 2018).format('YYYY-MM-DD HH:mm:ss'); | ||
``` | ||
|
||
* 🕒 Хорошо знакомые API и паттерны (шаблоны) Moment.js | ||
* 💪 Неизменная | ||
* 🔥 Цепная | ||
* 🌐 Поддержка интернационализации (I18n) | ||
* 📦 2kb мини-библиотека | ||
* 👫 Поддержка всеми браузерами | ||
|
||
--- | ||
|
||
## Начало работы | ||
|
||
### Документация | ||
|
||
Вы можете найти больше детальной информации, API, и других документов на веб-сайте [day.js.org](https://day.js.org/). | ||
|
||
### Установка | ||
|
||
```console | ||
npm install dayjs --save | ||
``` | ||
|
||
📚[Инструкция по установке](https://day.js.org/docs/en/installation/installation) | ||
|
||
### API | ||
|
||
API Day.js легко использовать для анализа, проверки, воздействия, и отображения дат и времени. | ||
|
||
```javascript | ||
dayjs('2018-08-08') // parse | ||
|
||
dayjs().format('{YYYY} MM-DDTHH:mm:ss SSS [Z] A') // отображение | ||
|
||
dayjs().set('month', 3).month() // получение значения и его установка | ||
|
||
dayjs().add(1, 'year') // влияние | ||
|
||
dayjs().isBefore(dayjs()) // осведомление | ||
``` | ||
|
||
📚[Ссылка на API](https://day.js.org/docs/en/parse/parse) | ||
|
||
### I18n | ||
|
||
Day.js обладает великолепной поддержкой интернационализации. | ||
|
||
Но ни одна из локализаций не будет включена в вашу сборку до тех пор, пока вы не начнете ее использовать. | ||
```javascript | ||
import 'dayjs/locale/es' // загрузка по требованию | ||
|
||
dayjs.locale('es') // глобальное использование Испанской локали | ||
|
||
dayjs('2018-05-05').locale('zh-cn').format() // использование упрощенной Китайской локали в конкретном случае | ||
``` | ||
📚[Интернационализация](https://day.js.org/docs/en/i18n/i18n) | ||
|
||
### Плагин | ||
|
||
Плагин - это независимый модуль, который может быть добавлен в Day.js с целью расширения функциональных возможностей или добавления новых особенностей. | ||
|
||
```javascript | ||
import advancedFormat from 'dayjs/plugin/advancedFormat' // загрузка по требованию | ||
|
||
dayjs.extend(advancedFormat) // использование плагина | ||
|
||
dayjs().format('Q Do k kk X x') // больше доступных форматов | ||
``` | ||
|
||
📚[Список плагинов](https://day.js.org/docs/en/plugin/plugin) | ||
|
||
## Спонсоры | ||
|
||
Поддержите этот проект, став спонсором. Ваш логотип будет показан здесь с ссылкой на ваш веб-сайт. [[Стать спонсором](https://opencollective.com/dayjs#sponsor)] | ||
|
||
<a href="https://opencollective.com/dayjs/sponsor/0/website" target="_blank"><img src="https://opencollective.com/dayjs/sponsor/0/avatar.svg"></a> | ||
<a href="https://opencollective.com/dayjs/sponsor/1/website" target="_blank"><img src="https://opencollective.com/dayjs/sponsor/1/avatar.svg"></a> | ||
<a href="https://opencollective.com/dayjs/sponsor/2/website" target="_blank"><img src="https://opencollective.com/dayjs/sponsor/2/avatar.svg"></a> | ||
<a href="https://opencollective.com/dayjs/sponsor/3/website" target="_blank"><img src="https://opencollective.com/dayjs/sponsor/3/avatar.svg"></a> | ||
|
||
## Контрибьюторы | ||
|
||
Этот проект существует благодаря всем людям, кто вносит свой вклад в его развитие. | ||
|
||
Пожалуйста поставьте 💖 звездочку 💖, чтобы поддержать нас. Спасибо. | ||
|
||
Также выражаю благодарность всем нашим спонсорам! 🙏 | ||
|
||
<a href="https://opencollective.com/dayjs/backer/0/website?requireActive=false" target="_blank"><img src="https://opencollective.com/dayjs/backer/0/avatar.svg?requireActive=false"></a> | ||
<a href="https://opencollective.com/dayjs/backer/1/website?requireActive=false" target="_blank"><img src="https://opencollective.com/dayjs/backer/1/avatar.svg?requireActive=false"></a> | ||
<a href="https://opencollective.com/dayjs/backer/2/website?requireActive=false" target="_blank"><img src="https://opencollective.com/dayjs/backer/2/avatar.svg?requireActive=false"></a> | ||
<a href="https://opencollective.com/dayjs/backer/3/website?requireActive=false" target="_blank"><img src="https://opencollective.com/dayjs/backer/3/avatar.svg?requireActive=false"></a> | ||
<a href="https://opencollective.com/dayjs#backers" target="_blank"><img src="https://opencollective.com/dayjs/contributors.svg?width=890" /></a> | ||
|
||
## Лицензия | ||
|
||
Day.js распростроняется под [лицензией MIT](./LICENSE). |
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,46 @@ | ||
// English (India) [en-in] | ||
import dayjs from 'dayjs' | ||
|
||
const locale = { | ||
name: 'en-in', | ||
weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), | ||
weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), | ||
weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), | ||
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), | ||
monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), | ||
weekStart: 1, | ||
yearStart: 4, | ||
relativeTime: { | ||
future: 'in %s', | ||
past: '%s ago', | ||
s: 'a few seconds', | ||
m: 'a minute', | ||
mm: '%d minutes', | ||
h: 'an hour', | ||
hh: '%d hours', | ||
d: 'a day', | ||
dd: '%d days', | ||
M: 'a month', | ||
MM: '%d months', | ||
y: 'a year', | ||
yy: '%d years' | ||
}, | ||
formats: { | ||
LT: 'HH:mm', | ||
LTS: 'HH:mm:ss', | ||
L: 'DD/MM/YYYY', | ||
LL: 'D MMMM YYYY', | ||
LLL: 'D MMMM YYYY HH:mm', | ||
LLLL: 'dddd, D MMMM YYYY HH:mm' | ||
}, | ||
ordinal: (n) => { | ||
const s = ['th', 'st', 'nd', 'rd'] | ||
const v = n % 100 | ||
return `[${n}${(s[(v - 20) % 10] || s[v] || s[0])}]` | ||
} | ||
} | ||
|
||
dayjs.locale(locale, null, true) | ||
|
||
export default locale | ||
|
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,46 @@ | ||
// English (Trinidad & Tobago) [en-tt] | ||
import dayjs from 'dayjs' | ||
|
||
const locale = { | ||
name: 'en-tt', | ||
weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), | ||
weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), | ||
weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), | ||
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), | ||
monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), | ||
weekStart: 1, | ||
yearStart: 4, | ||
relativeTime: { | ||
future: 'in %s', | ||
past: '%s ago', | ||
s: 'a few seconds', | ||
m: 'a minute', | ||
mm: '%d minutes', | ||
h: 'an hour', | ||
hh: '%d hours', | ||
d: 'a day', | ||
dd: '%d days', | ||
M: 'a month', | ||
MM: '%d months', | ||
y: 'a year', | ||
yy: '%d years' | ||
}, | ||
formats: { | ||
LT: 'HH:mm', | ||
LTS: 'HH:mm:ss', | ||
L: 'DD/MM/YYYY', | ||
LL: 'D MMMM YYYY', | ||
LLL: 'D MMMM YYYY HH:mm', | ||
LLLL: 'dddd, D MMMM YYYY HH:mm' | ||
}, | ||
ordinal: (n) => { | ||
const s = ['th', 'st', 'nd', 'rd'] | ||
const v = n % 100 | ||
return `[${n}${(s[(v - 20) % 10] || s[v] || s[0])}]` | ||
} | ||
} | ||
|
||
dayjs.locale(locale, null, true) | ||
|
||
export default locale | ||
|
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
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
Oops, something went wrong.