From 44d40f48ec5f903c93f37e5d12c885d3541062ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Feje=C5=A1?= Date: Thu, 11 Jan 2018 10:14:13 +0100 Subject: [PATCH] remove toEnglishDate --- snippets/toEnglishDate.md | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 snippets/toEnglishDate.md diff --git a/snippets/toEnglishDate.md b/snippets/toEnglishDate.md deleted file mode 100644 index 5c078ba37..000000000 --- a/snippets/toEnglishDate.md +++ /dev/null @@ -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' -```