Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Commit

Permalink
Merge branch 'latest' into pullinicons
Browse files Browse the repository at this point in the history
  • Loading branch information
OlgaLyubin authored Sep 20, 2019
2 parents adbf74e + fe5913d commit f892586
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/utilities/psammead-locales/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- prettier-ignore -->
| Version | Description |
| ------- | ----------- |
| 2.14.0 | [PR#2178](https://github.com/bbc/psammead/pull/2178) Update `ps` (Pashto) locale to add relative time support |
| 2.13.0 | [PR#2193](https://github.com/bbc/psammead/pull/2193) Create `rw` (Gahuza) and `ti` (Tigrinya) locales |
| 2.12.0 | [PR#2179](https://github.com/bbc/psammead/pull/2179) Create `om` (Afaan Oromoo) and `am` (Amharic) locales |
| 2.11.0 | [PR#2196](https://github.com/bbc/psammead/pull/2196) Create `ha` (Hausa) and `so` (Somali) locales |
Expand Down
9 changes: 8 additions & 1 deletion packages/utilities/psammead-locales/moment/ps.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@ var pashtoGregorianMonths = 'جنوري_فبروري_مارچ_اپریل_می_ج
var jalaliFormats = ['D MMMM YYYY', 'LL'];

moment.defineLocale('ps', {
// Gregorian Months
months: pashtoGregorianMonths,
monthsShort: pashtoGregorianMonths,
relativeTime: {
past: '%s مخکې', // %s 'ago'
s: 'یو څو ثانیې', // 'a few seconds'
m: 'یوه دقیقه', // 'a minute'
mm: '%d دقیقې', // %d 'minutes'
h: 'یو ساعت', // 'an hour'
hh: '%d ساعتونه', // %d 'hours'
},
postformat: function(string) {
var str = jalaaliHelper.addJalaliDate(
'ps',
Expand Down
14 changes: 14 additions & 0 deletions packages/utilities/psammead-locales/moment/ps.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,17 @@ test('format', function () {
assert.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
}
});

test('from', function () {
var start = moment([2007, 1, 28]);
assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'یو څو ثانیې', '44 seconds = a few seconds');
assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'یوه دقیقه', '45 seconds = a minute');
assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'یوه دقیقه', '89 seconds = a minute');
assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '۲ دقیقې', '90 seconds = 2 minutes');
assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '۴۴ دقیقې', '44 minutes = 44 minutes');
assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'یو ساعت', '45 minutes = an hour');
assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'یو ساعت', '89 minutes = an hour');
assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '۲ ساعتونه', '90 minutes = 2 hours');
assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '۵ ساعتونه', '5 hours = 5 hours');
assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '۲۱ ساعتونه', '21 hours = 21 hours');
});
2 changes: 1 addition & 1 deletion packages/utilities/psammead-locales/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/utilities/psammead-locales/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bbc/psammead-locales",
"version": "2.13.0",
"version": "2.14.0",
"description": "A collection of locale configs, used in BBC World Service sites",
"repository": {
"type": "git",
Expand Down

0 comments on commit f892586

Please sign in to comment.