diff --git a/README.md b/README.md
index 573d0cba..c1394b9c 100644
--- a/README.md
+++ b/README.md
@@ -40,13 +40,17 @@ dayjs().startOf('month').add(1, 'day').set('year', 2018).format('YYYY-MM-DD HH:m
## Getting Started
+### Documentation
+
+You can find for more details, API, and other docs on [day.js.org](https://day.js.org/) website.
+
### Installation
```console
npm install dayjs --save
```
-📚[Installation Guide](./docs/en/Installation.md)
+📚[Installation Guide](https://day.js.org/docs/en/installation/installation)
### API
@@ -64,7 +68,7 @@ dayjs().add(1, 'year') // manipulate
dayjs().isBefore(dayjs()) // query
```
-📚[API Reference](./docs/en/API-reference.md)
+📚[API Reference](https://day.js.org/docs/en/parse/parse)
### I18n
@@ -79,7 +83,7 @@ dayjs.locale('es') // use Spanish locale globally
dayjs('2018-05-05').locale('zh-cn').format() // use Chinese Simplified locale in a specific instance
```
-📚[Internationalization](./docs/en/I18n.md)
+📚[Internationalization](https://day.js.org/docs/en/i18n/i18n)
### Plugin
@@ -93,7 +97,7 @@ dayjs.extend(advancedFormat) // use plugin
dayjs().format('Q Do k kk X x') // more available formats
```
-📚[Plugin List](./docs/en/Plugin.md)
+📚[Plugin List](https://day.js.org/docs/en/plugin/plugin)
## Sponsors
diff --git a/docs/en/API-reference.md b/docs/en/API-reference.md
index 8dd7d797..c4b50f09 100644
--- a/docs/en/API-reference.md
+++ b/docs/en/API-reference.md
@@ -1,3 +1,23 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
+
# API Reference
Instead of modifying the native `Date.prototype`, Day.js creates a wrapper for the Date object, called `Dayjs` object.
diff --git a/docs/en/I18n.md b/docs/en/I18n.md
index f1100da0..006c365e 100644
--- a/docs/en/I18n.md
+++ b/docs/en/I18n.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
## Internationalization
Day.js has great support for internationalization.
diff --git a/docs/en/Installation.md b/docs/en/Installation.md
index 9235767e..2738f726 100644
--- a/docs/en/Installation.md
+++ b/docs/en/Installation.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
## Installation Guide
You have multiple ways of getting Day.js:
diff --git a/docs/en/Plugin.md b/docs/en/Plugin.md
index c8ba4fc7..e69798f9 100644
--- a/docs/en/Plugin.md
+++ b/docs/en/Plugin.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
# Plugin List
A plugin is an independent module that can be added to Day.js to extend functionality or add new features.
diff --git a/docs/es-es/API-reference.md b/docs/es-es/API-reference.md
index be0f3002..22f2fd3f 100644
--- a/docs/es-es/API-reference.md
+++ b/docs/es-es/API-reference.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
# Referencia de la API
En lugar de modificar el `Date.prototype` nativo, Day.js construye una abstracción sobre el objeto `Date`: el objeto `Dayjs`.
diff --git a/docs/es-es/I18n.md b/docs/es-es/I18n.md
index 839fb266..b9a69d01 100644
--- a/docs/es-es/I18n.md
+++ b/docs/es-es/I18n.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
# Internacionalización
Day.js soporta muy bien la internacionalización.
diff --git a/docs/es-es/Installation.md b/docs/es-es/Installation.md
index cebdf626..6abc31ab 100644
--- a/docs/es-es/Installation.md
+++ b/docs/es-es/Installation.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
# Guía de instalación
Tienes a tu disposición varias opciones para obtener y utilizar Day.js:
diff --git a/docs/es-es/Plugin.md b/docs/es-es/Plugin.md
index e5a7c146..a80df8d2 100644
--- a/docs/es-es/Plugin.md
+++ b/docs/es-es/Plugin.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
# Lista de complementos
Un complemento o _plugin_ es un módulo independiente que puede añadirse a Day.js para extender su funcionalidad o añadir nuevas características.
diff --git a/docs/es-es/README-es-es.md b/docs/es-es/README-es-es.md
index 7e7d6bc8..f0f8f94c 100644
--- a/docs/es-es/README-es-es.md
+++ b/docs/es-es/README-es-es.md
@@ -42,13 +42,17 @@ dayjs()
# Primeros pasos
+### Documentation
+
+You can find for more details, API, and other docs on [day.js.org](https://day.js.org/) website.
+
## Instalación
```console
npm install dayjs --save
```
-📚[Guía de instalación](./Installation.md)
+📚[Guía de instalación](https://day.js.org/docs/en/installation/installation)
## API
@@ -68,7 +72,7 @@ dayjs().add(1, 'year') // manipula
dayjs().isBefore(dayjs()) // consulta
```
-📚[Referencia de la API](./API-reference.md)
+📚[Referencia de la API](https://day.js.org/docs/en/parse/parse)
## I18n
@@ -86,7 +90,7 @@ dayjs('2018-05-05')
.format() // usar el chino simplificado en una instancia concreta
```
-📚[Internacionalización](./I18n.md)
+📚[Internacionalización](https://day.js.org/docs/en/i18n/i18n)
## Complementos
@@ -100,7 +104,7 @@ dayjs.extend(advancedFormat) // uso del complemento
dayjs().format('Q Do k kk X x') // ahora tenemos más formatos disponibles
```
-📚[Lista de complementos](./Plugin.md)
+📚[Lista de complementos](https://day.js.org/docs/en/plugin/plugin)
## Patrocinadores
diff --git a/docs/ja/API-reference.md b/docs/ja/API-reference.md
index 0eba8f21..0ccce6b2 100644
--- a/docs/ja/API-reference.md
+++ b/docs/ja/API-reference.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
## API Reference
Day.js は組み込みの `Date.prototype` を変更する代わりに `Dayjs` オブジェクトと呼ばれる Date オブジェクトのラッパーを作成します。
diff --git a/docs/ja/I18n.md b/docs/ja/I18n.md
index 1fb090b7..59c62c65 100644
--- a/docs/ja/I18n.md
+++ b/docs/ja/I18n.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
## 国際化
Day.js は国際化を手厚くサポートしています。
diff --git a/docs/ja/Installation.md b/docs/ja/Installation.md
index a2e6055f..b3d471e8 100644
--- a/docs/ja/Installation.md
+++ b/docs/ja/Installation.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
## インストールガイド
複数の方法で Day.js を使用することができます
diff --git a/docs/ja/Plugin.md b/docs/ja/Plugin.md
index b8e7580e..600bb94a 100644
--- a/docs/ja/Plugin.md
+++ b/docs/ja/Plugin.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
# プラグインリスト
プラグインとは、 Day.js の機能を拡張したり、新たな機能を追加するための独立したモジュールのことです。
diff --git a/docs/ja/README-ja.md b/docs/ja/README-ja.md
index 6866bd2e..329d34c3 100644
--- a/docs/ja/README-ja.md
+++ b/docs/ja/README-ja.md
@@ -42,13 +42,17 @@ dayjs()
## はじめに
+### Documentation
+
+You can find for more details, API, and other docs on [day.js.org](https://day.js.org/) website.
+
### インストール
```console
npm install dayjs --save
```
-📚[インストールガイド](./Installation.md)
+📚[インストールガイド](https://day.js.org/docs/en/installation/installation)
### API
@@ -68,7 +72,7 @@ dayjs().add(1, 'year') // 操作
dayjs().isBefore(dayjs()) // クエリ
```
-📚[API リファレンス](./API-reference.md)
+📚[API リファレンス](https://day.js.org/docs/en/parse/parse)
### 国際化 (I18n)
@@ -86,7 +90,7 @@ dayjs('2018-05-05')
.format() // 簡体字中国語を特定のインスタンスにのみ適用
```
-📚[国際化](./I18n.md)
+📚[国際化](https://day.js.org/docs/en/i18n/i18n)
### プラグイン
@@ -100,7 +104,7 @@ dayjs.extend(advancedFormat) // プラグインを使用
dayjs().format('Q Do k kk X x') // 多様なフォーマットが利用可能に
```
-📚[プラグインリスト](./Plugin.md)
+📚[プラグインリスト](https://day.js.org/docs/en/plugin/plugin)
## ライセンス
diff --git a/docs/ko/API-reference.md b/docs/ko/API-reference.md
index 70cb5d67..763fa9e8 100644
--- a/docs/ko/API-reference.md
+++ b/docs/ko/API-reference.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
## API Reference
Day.js는 네이티브 `Date.prototype`을 수정하는 대신 `Dayjs` 오브젝트인 Date 오브젝트 래퍼를 생성합니다.
diff --git a/docs/ko/I18n.md b/docs/ko/I18n.md
index e7d73320..e96fece9 100644
--- a/docs/ko/I18n.md
+++ b/docs/ko/I18n.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
## Internationalization
Day.js는 많은 다국어를 지원합니다.
diff --git a/docs/ko/Installation.md b/docs/ko/Installation.md
index 2e0825f2..d3c96145 100644
--- a/docs/ko/Installation.md
+++ b/docs/ko/Installation.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
## Installation Guide
Day.js를 가져오는 방법은 여러가지가 있습니다:
diff --git a/docs/ko/Plugin.md b/docs/ko/Plugin.md
index 90a9e342..836909b3 100644
--- a/docs/ko/Plugin.md
+++ b/docs/ko/Plugin.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
# Plugin List
플러그인은 기능을 확장하거나 새로운 기능을 추가하기 위해 Day.js에 추가할 수 있는 독립적인 모듈입니다.
diff --git a/docs/ko/README-ko.md b/docs/ko/README-ko.md
index e24e316c..a80648e8 100644
--- a/docs/ko/README-ko.md
+++ b/docs/ko/README-ko.md
@@ -42,13 +42,17 @@ dayjs()
## 시작해볼까요!
+### Documentation
+
+You can find for more details, API, and other docs on [day.js.org](https://day.js.org/) website.
+
### 설치
```console
npm install dayjs --save
```
-📚[설치 가이드](./Installation.md)
+📚[설치 가이드](https://day.js.org/docs/en/installation/installation)
### API
@@ -68,7 +72,7 @@ dayjs().add(1, 'year') // manipulate
dayjs().isBefore(dayjs()) // query
```
-📚[API 참고](./API-reference.md)
+📚[API 참고](https://day.js.org/docs/en/parse/parse)
### I18n
@@ -86,7 +90,7 @@ dayjs('2018-05-05')
.format() // use Chinese Simplified locale in a specific instance
```
-📚[I18n](./I18n.md)
+📚[I18n](https://day.js.org/docs/en/i18n/i18n)
### Plugin
@@ -100,7 +104,7 @@ dayjs.extend(advancedFormat) // use plugin
dayjs().format('Q Do k kk X x') // more available formats
```
-📚[플러그인 목록](./Plugin.md)
+📚[플러그인 목록](https://day.js.org/docs/en/plugin/plugin)
## License
diff --git a/docs/pt-br/API-reference.md b/docs/pt-br/API-reference.md
index 18c165e8..62c29685 100644
--- a/docs/pt-br/API-reference.md
+++ b/docs/pt-br/API-reference.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
## Referência da API
Ao invés de modificar o `Date.prototype` nativo, o Day.js empacota o objeto nativo `Date` em um objeto `Dayjs`.
diff --git a/docs/pt-br/I18n.md b/docs/pt-br/I18n.md
index 18fef9b5..bc76192c 100644
--- a/docs/pt-br/I18n.md
+++ b/docs/pt-br/I18n.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
## Internacionalização
Day.js possui um ótimo suporte para internacionalização.
diff --git a/docs/pt-br/Installation.md b/docs/pt-br/Installation.md
index da648129..bbe81fa5 100644
--- a/docs/pt-br/Installation.md
+++ b/docs/pt-br/Installation.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
## Guia de Instalação
Existem várias maneiras de incluir o Day.js em seu projeto:
diff --git a/docs/pt-br/Plugin.md b/docs/pt-br/Plugin.md
index 8e16f5f5..6b456170 100644
--- a/docs/pt-br/Plugin.md
+++ b/docs/pt-br/Plugin.md
@@ -1,3 +1,22 @@
+### Notice
+
+The document here **no longer** updates.
+
+Please visit our website [https://day.js.org](https://day.js.org) for more information.
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
# Lista de Plugins
Um plugin é um módulo independente que pode ser adicionado ao Day.js para estendê-lo ou adicionar novas funcionalidades.
diff --git a/docs/pt-br/README-pt-br.md b/docs/pt-br/README-pt-br.md
index 1b18e891..7123dd2e 100644
--- a/docs/pt-br/README-pt-br.md
+++ b/docs/pt-br/README-pt-br.md
@@ -42,13 +42,17 @@ dayjs()
## Começando
+### Documentation
+
+You can find for more details, API, and other docs on [day.js.org](https://day.js.org/) website.
+
### Instalação
```console
npm install dayjs --save
```
-📚[Guia de instalação](./Installation.md)
+📚[Guia de instalação](https://day.js.org/docs/en/installation/installation)
### API
@@ -68,7 +72,7 @@ dayjs().add(1, 'year') // manipula
dayjs().isBefore(dayjs()) // verifica
```
-📚[Referência da API](./API-reference.md)
+📚[Referência da API](https://day.js.org/docs/en/parse/parse)
### I18n
@@ -86,7 +90,7 @@ dayjs('2018-05-05')
.format() // usar locale em português brasileiro em uma instância específica
```
-📚[Internacionalização](./I18n.md)
+📚[Internacionalização](https://day.js.org/docs/en/i18n/i18n)
### Plugin
@@ -100,7 +104,7 @@ dayjs.extend(advancedFormat) // usar plugin
dayjs().format('Q Do k kk X x') // mais formatos disponíveis pelo plugin
```
-📚[Lista de Plugins](./Plugin.md)
+📚[Lista de Plugins](https://day.js.org/docs/en/plugin/plugin)
## Patrocinadores
diff --git a/docs/zh-cn/API-reference.md b/docs/zh-cn/API-reference.md
index 02465a8a..236ef73c 100644
--- a/docs/zh-cn/API-reference.md
+++ b/docs/zh-cn/API-reference.md
@@ -1,3 +1,22 @@
+### 提醒
+
+此处的文档将**不再**更新。
+
+请访问网站 [https://day.js.org](https://day.js.org) 查看更多信息。
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
## API
`Dayjs` 并没有改变或覆盖 Javascript 原生的 `Date.prototype`, 而是创造了一个全新的包含 `Javascript Date` 对象的 `Dayjs` 的对象。
diff --git a/docs/zh-cn/I18n.md b/docs/zh-cn/I18n.md
index 29e1875b..3f9cb2f4 100644
--- a/docs/zh-cn/I18n.md
+++ b/docs/zh-cn/I18n.md
@@ -1,3 +1,22 @@
+### 提醒
+
+此处的文档将**不再**更新。
+
+请访问网站 [https://day.js.org](https://day.js.org) 查看更多信息。
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
## 国际化 I18n
Day.js 支持国际化
diff --git a/docs/zh-cn/Installation.md b/docs/zh-cn/Installation.md
index 46f4deeb..f4a0a935 100644
--- a/docs/zh-cn/Installation.md
+++ b/docs/zh-cn/Installation.md
@@ -1,3 +1,22 @@
+### 提醒
+
+此处的文档将**不再**更新。
+
+请访问网站 [https://day.js.org](https://day.js.org) 查看更多信息。
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
## 安装指南
可以有如下多种方法安装使用 Day.js:
diff --git a/docs/zh-cn/Plugin.md b/docs/zh-cn/Plugin.md
index 89bdf56c..8838b280 100644
--- a/docs/zh-cn/Plugin.md
+++ b/docs/zh-cn/Plugin.md
@@ -1,3 +1,22 @@
+### 提醒
+
+此处的文档将**不再**更新。
+
+请访问网站 [https://day.js.org](https://day.js.org) 查看更多信息。
+
+-------------
+
+
+
+
+
+
+
+
+
+
+
+
# 插件列表
插件是一些独立的程序,可以给 Day.js 增加新功能和扩展已有功能
diff --git a/docs/zh-cn/README.zh-CN.md b/docs/zh-cn/README.zh-CN.md
index 82c488c1..3fd8ed4a 100644
--- a/docs/zh-cn/README.zh-CN.md
+++ b/docs/zh-cn/README.zh-CN.md
@@ -42,13 +42,17 @@ dayjs()
## 快速开始
+### 文档
+
+访问 [day.js.org](https://day.js.org/) 网站查看更详细的文档
+
### 安装
```console
npm install dayjs --save
```
-📚[安装指南](./Installation.md)
+📚[安装指南](https://day.js.org/docs/en/installation/installation)
### API
@@ -68,7 +72,7 @@ dayjs().add(1, 'year') // 处理
dayjs().isBefore(dayjs()) // 查询
```
-📚[API 参考](./API-reference.md)
+📚[API 参考](https://day.js.org/docs/en/parse/parse)
### 国际化 I18n
@@ -86,7 +90,7 @@ dayjs('2018-05-05')
.format() // 在这个实例上使用简体中文
```
-📚[国际化 I18n](./I18n.md)
+📚[国际化 I18n](https://day.js.org/docs/en/i18n/i18n)
### 插件
@@ -100,7 +104,7 @@ dayjs.extend(advancedFormat) // 使用插件
dayjs().format('Q Do k kk X x') // 使用扩展后的API
```
-📚[插件列表](./Plugin.md)
+📚[插件列表](https://day.js.org/docs/en/plugin/plugin)
## 开源协议
diff --git a/package.json b/package.json
index 359cc2c5..174d4cb7 100644
--- a/package.json
+++ b/package.json
@@ -61,6 +61,7 @@
],
"author": "iamkun",
"license": "MIT",
+ "homepage": "https://day.js.org/",
"repository": {
"type": "git",
"url": "https://github.com/iamkun/dayjs.git"
diff --git a/src/locale/fi.js b/src/locale/fi.js
index 3e7103eb..0ff83ee1 100644
--- a/src/locale/fi.js
+++ b/src/locale/fi.js
@@ -1,6 +1,43 @@
// Finnish [fi]
import dayjs from 'dayjs'
+function relativeTimeFormatter(number, withoutSuffix, key, isFuture) {
+ const past = {
+ s: 'muutama sekunti',
+ m: 'minuutti',
+ mm: '%d minuuttia',
+ h: 'tunti',
+ hh: '%d tuntia',
+ d: 'päivä',
+ dd: '%d päivää',
+ M: 'kuukausi',
+ MM: '%d kuukautta',
+ y: 'vuosi',
+ yy: '%d vuotta',
+ numbers: 'nolla_yksi_kaksi_kolme_neljä_viisi_kuusi_seitsemän_kahdeksan_yhdeksän'.split('_')
+ }
+ const future = {
+ s: 'muutaman sekunnin',
+ m: 'minuutin',
+ mm: '%d minuutin',
+ h: 'tunnin',
+ hh: '%d tunnin',
+ d: 'päivän',
+ dd: '%d päivän',
+ M: 'kuukauden',
+ MM: '%d kuukauden',
+ y: 'vuoden',
+ yy: '%d vuoden',
+ numbers: 'nollan_yhden_kahden_kolmen_neljän_viiden_kuuden_seitsemän_kahdeksan_yhdeksän'.split('_')
+ }
+ const words = (isFuture && !withoutSuffix) ? future : past
+ const result = words[key]
+ if (number < 10) {
+ return result.replace('%d', words.numbers[number])
+ }
+ return result.replace('%d', number)
+}
+
const locale = {
name: 'fi', // Finnish
weekdays: 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split('_'), // Note weekdays are not capitalized in Finnish
@@ -10,29 +47,20 @@ const locale = {
monthsShort: 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split('_'),
ordinal: n => `${n}.`,
weekStart: 1,
- /*
- * This relativeTime is currently configured for having proper past
- * tense forms since Finnish needs a separate version for future tense
- * and I think past tense is a more common use case for this kind of
- * library.
- *
- * Doing this properly requires this issue to be fixed:
- * https://github.com/iamkun/dayjs/issues/302
- */
relativeTime: {
- future: '%s kuluttua',
+ future: '%s päästä',
past: '%s sitten',
- s: 'muutama sekunti', // for past tense
- m: 'minuutti', // for past tense
- mm: '%d minuuttia', // for past tense
- h: 'tunti', // for past tense
- hh: '%d tuntia', // for past tense
- d: 'päivä', // for past tense
- dd: '%d päivää', // for past tense
- M: 'kuukausi', // for past tense
- MM: '%d kuukautta', // for past tense
- y: 'vuosi', // for past tense
- yy: '%d vuotta' // for past tense
+ s: relativeTimeFormatter,
+ m: relativeTimeFormatter,
+ mm: relativeTimeFormatter,
+ h: relativeTimeFormatter,
+ hh: relativeTimeFormatter,
+ d: relativeTimeFormatter,
+ dd: relativeTimeFormatter,
+ M: relativeTimeFormatter,
+ MM: relativeTimeFormatter,
+ y: relativeTimeFormatter,
+ yy: relativeTimeFormatter
},
formats: {
LT: 'HH.mm',
diff --git a/src/utils.js b/src/utils.js
index 01921d46..7b1712bd 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -32,6 +32,7 @@ const prettyUnit = (u) => {
y: C.Y,
w: C.W,
d: C.D,
+ D: C.DATE,
h: C.H,
m: C.MIN,
s: C.S,
diff --git a/test/locale/fi.test.js b/test/locale/fi.test.js
new file mode 100644
index 00000000..9c5e27a8
--- /dev/null
+++ b/test/locale/fi.test.js
@@ -0,0 +1,44 @@
+import MockDate from 'mockdate'
+import moment from 'moment'
+import dayjs from '../../src'
+import relativeTime from '../../src/plugin/relativeTime'
+import '../../src/locale/fi'
+
+dayjs.extend(relativeTime)
+
+beforeEach(() => {
+ MockDate.set(new Date())
+})
+
+afterEach(() => {
+ MockDate.reset()
+})
+
+it('Finnish locale relative time in past and future', () => {
+ const cases = [
+ [1, 'd', 'päivän päästä'],
+ [-1, 'd', 'päivä sitten'],
+ [2, 'd', 'kahden päivän päästä'],
+ [-2, 'd', 'kaksi päivää sitten'],
+ [10, 'd', '10 päivän päästä'],
+ [-10, 'd', '10 päivää sitten'],
+ [6, 'm', 'kuuden minuutin päästä'],
+ [-6, 'm', 'kuusi minuuttia sitten'],
+ [5, 'h', 'viiden tunnin päästä'],
+ [-5, 'h', 'viisi tuntia sitten'],
+ [3, 'M', 'kolmen kuukauden päästä'],
+ [-3, 'M', 'kolme kuukautta sitten'],
+ [4, 'y', 'neljän vuoden päästä'],
+ [-4, 'y', 'neljä vuotta sitten']
+ ]
+ cases.forEach((c) => {
+ expect(dayjs().add(c[0], c[1]).locale('fi').fromNow())
+ .toBe(c[2])
+ expect(dayjs().add(c[0], c[1]).locale('fi').fromNow())
+ .toBe(moment().add(c[0], c[1]).locale('fi').fromNow())
+ })
+ expect(dayjs().add(-10, 'd').locale('fi').fromNow(true))
+ .toBe('10 päivää')
+ expect(dayjs().add(-10, 'd').locale('fi').fromNow(true))
+ .toBe(moment().add(-10, 'd').locale('fi').fromNow(true))
+})
diff --git a/test/utils.test.js b/test/utils.test.js
index f49dcf50..0d7e6e04 100644
--- a/test/utils.test.js
+++ b/test/utils.test.js
@@ -8,9 +8,17 @@ it('PrettyUnit', () => {
expect(prettyUnit('Days')).toBe('day')
expect(prettyUnit('days')).toBe('day')
expect(prettyUnit('day')).toBe('day')
- expect(prettyUnit('Q')).toBe('quarter')
expect(prettyUnit('quarter')).toBe('quarter')
expect(prettyUnit('quarters')).toBe('quarter')
+ expect(prettyUnit('D')).toBe('date')
+ expect(prettyUnit('d')).toBe('day')
+ expect(prettyUnit('M')).toBe('month')
+ expect(prettyUnit('y')).toBe('year')
+ expect(prettyUnit('h')).toBe('hour')
+ expect(prettyUnit('m')).toBe('minute')
+ expect(prettyUnit('s')).toBe('second')
+ expect(prettyUnit('ms')).toBe('millisecond')
+ expect(prettyUnit('Q')).toBe('quarter')
expect(prettyUnit()).toBe('')
})
diff --git a/types/plugin/dayOfYear.d.ts b/types/plugin/dayOfYear.d.ts
index 02838515..4fd66011 100644
--- a/types/plugin/dayOfYear.d.ts
+++ b/types/plugin/dayOfYear.d.ts
@@ -6,5 +6,6 @@ export = plugin
declare module 'dayjs' {
interface Dayjs {
dayOfYear(): number
+ dayOfYear(value: number): Dayjs
}
}