Merge pull request #533 from Chalarangelo/toEnglishDate-remove

Resolves #523
This commit is contained in:
Angelos Chalaris
2018-01-11 11:24:39 +02:00
committed by GitHub
3 changed files with 0 additions and 43 deletions

View File

@ -1,21 +0,0 @@
### toEnglishDate
Converts a date from American format to English format.
Use `Date.toISOString()`, `split('T')` and `replace()` to convert a date from American format to the English format.
Throws an error if the passed time cannot be converted to a date.
```js
const toEnglishDate = time => {
try {
return new Date(time)
.toISOString()
.split('T')[0]
.replace(/-/g, '/');
} catch (e) {}
};
```
```js
toEnglishDate('09/21/2010'); // '21/09/2010'
```

View File

@ -1,8 +0,0 @@
module.exports = toEnglishDate = time => {
try {
return new Date(time)
.toISOString()
.split('T')[0]
.replace(/-/g, '/');
} catch (e) {}
};

View File

@ -1,14 +0,0 @@
const test = require('tape');
const toEnglishDate = require('./toEnglishDate.js');
test('Testing toEnglishDate', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof toEnglishDate === 'function', 'toEnglishDate is a Function');
// t.equal(toEnglishDate('09/21/2010'), '21/09/2010', 'Converts a date from American format to English format');
//t.deepEqual(toEnglishDate(args..), 'Expected');
//t.equal(toEnglishDate(args..), 'Expected');
//t.false(toEnglishDate(args..), 'Expected');
//t.throws(toEnglishDate(args..), 'Expected');
t.end();
});