-
-
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 #909 from iamkun/dev
D2M
- Loading branch information
Showing
12 changed files
with
599 additions
and
28 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
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,36 @@ | ||
// Kinyarwanda (Rwanda) [rw] | ||
import dayjs from 'dayjs' | ||
|
||
const locale = { | ||
name: 'rw', | ||
weekdays: 'Ku Cyumweru_Kuwa Mbere_Kuwa Kabiri_Kuwa Gatatu_Kuwa Kane_Kuwa Gatanu_Kuwa Gatandatu'.split('_'), | ||
months: 'Mutarama_Gashyantare_Werurwe_Mata_Gicurasi_Kamena_Nyakanga_Kanama_Nzeri_Ukwakira_Ugushyingo_Ukuboza'.split('_'), | ||
relativeTime: { | ||
future: 'mu %s', | ||
past: '%s', | ||
s: 'amasegonda', | ||
m: 'Umunota', | ||
mm: '%d iminota', | ||
h: 'isaha', | ||
hh: '%d amasaha', | ||
d: 'Umunsi', | ||
dd: '%d iminsi', | ||
M: 'ukwezi', | ||
MM: '%d amezi', | ||
y: 'umwaka', | ||
yy: '%d imyaka' | ||
}, | ||
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 => n | ||
} | ||
|
||
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,40 @@ | ||
// Turkmen [tk] | ||
import dayjs from 'dayjs' | ||
|
||
const locale = { | ||
name: 'tk', | ||
weekdays: 'Ýekşenbe_Duşenbe_Sişenbe_Çarşenbe_Penşenbe_Anna_Şenbe'.split('_'), | ||
weekdaysShort: 'Ýek_Duş_Siş_Çar_Pen_Ann_Şen'.split('_'), | ||
weekdaysMin: 'Ýk_Dş_Sş_Çr_Pn_An_Şn'.split('_'), | ||
months: 'Ýanwar_Fewral_Mart_Aprel_Maý_Iýun_Iýul_Awgust_Sentýabr_Oktýabr_Noýabr_Dekabr'.split('_'), | ||
monthsShort: 'Ýan_Few_Mar_Apr_Maý_Iýn_Iýl_Awg_Sen_Okt_Noý_Dek'.split('_'), | ||
weekStart: 1, | ||
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' | ||
}, | ||
relativeTime: { | ||
future: '%s soň', | ||
past: '%s öň', | ||
s: 'birnäçe sekunt', | ||
m: 'bir minut', | ||
mm: '%d minut', | ||
h: 'bir sagat', | ||
hh: '%d sagat', | ||
d: 'bir gün', | ||
dd: '%d gün', | ||
M: 'bir aý', | ||
MM: '%d aý', | ||
y: 'bir ýyl', | ||
yy: '%d ýyl' | ||
}, | ||
ordinal: n => `${n}.` | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
export default (o, c) => { | ||
const proto = c.prototype | ||
const isObject = obj => !(obj instanceof Date) && !(obj instanceof Array) && obj instanceof Object | ||
const prettyUnit = (u) => { | ||
const unit = proto.$utils().p(u) | ||
return unit === 'date' ? 'day' : unit | ||
} | ||
const parseDate = (cfg) => { | ||
const { date, utc } = cfg | ||
const $d = {} | ||
if (isObject(date)) { | ||
Object.keys(date).forEach((k) => { | ||
$d[prettyUnit(k)] = date[k] | ||
}) | ||
const y = $d.year || 1970 | ||
const M = $d.month - 1 || 0 | ||
const d = $d.day || 1 | ||
const h = $d.hour || 0 | ||
const m = $d.minute || 0 | ||
const s = $d.second || 0 | ||
const ms = $d.millisecond || 0 | ||
if (utc) { | ||
return new Date(Date.UTC(y, M, d, h, m, s, ms)) | ||
} | ||
return new Date(y, M, d, h, m, s, ms) | ||
} | ||
return date | ||
} | ||
|
||
const oldParse = proto.parse | ||
proto.parse = function (cfg) { | ||
cfg.date = parseDate.bind(this)(cfg) | ||
oldParse.bind(this)(cfg) | ||
} | ||
|
||
const oldSet = proto.set | ||
const oldAdd = proto.add | ||
|
||
const callObject = function (call, argument, string, offset = 1) { | ||
if (argument instanceof Object) { | ||
const keys = Object.keys(argument) | ||
let chain = this | ||
keys.forEach((key) => { | ||
chain = call.bind(chain)(argument[key] * offset, key) | ||
}) | ||
return chain | ||
} | ||
return call.bind(this)(argument * offset, string) | ||
} | ||
|
||
proto.set = function (string, int) { | ||
int = int === undefined ? string : int | ||
return callObject.bind(this)(function (i, s) { | ||
return oldSet.bind(this)(s, i) | ||
}, int, string) | ||
} | ||
proto.add = function (number, string) { | ||
return callObject.bind(this)(oldAdd, number, string) | ||
} | ||
proto.subtract = function (number, string) { | ||
return callObject.bind(this)(oldAdd, number, string, -1) | ||
} | ||
} |
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.