Ts all the tests (#1998)

* Convert tests to TypeScript

* Add types for tests

* Rename files to TS

* Fix up test imports

* Fix TSC errors

* Liiiint

* Add types to util method signatures

* Some more types
This commit is contained in:
Paulus Schoutsen
2018-11-06 10:09:09 +01:00
committed by GitHub
parent 856ef34964
commit cdb2093ea6
78 changed files with 524 additions and 364 deletions

View File

@@ -0,0 +1,22 @@
import * as fecha from "fecha";
// Check for support of native locale string options
function toLocaleStringSupportsOptions() {
try {
new Date().toLocaleString("i");
} catch (e) {
return e.name === "RangeError";
}
return false;
}
export default (toLocaleStringSupportsOptions()
? (dateObj: Date, locales: string) =>
dateObj.toLocaleString(locales, {
year: "numeric",
month: "long",
day: "numeric",
hour: "numeric",
minute: "2-digit",
})
: (dateObj: Date) => fecha.format(dateObj, "haDateTime"));