diff --git a/boilerplate/client/package.json b/boilerplate/client/package.json index 0bf4cf0..74b4f32 100644 --- a/boilerplate/client/package.json +++ b/boilerplate/client/package.json @@ -5,7 +5,7 @@ "clean": "rm -rf node_modules" }, "dependencies": { - "@noyainrain/micro": "^0.44" + "@noyainrain/micro": "^0.45" }, "devDependencies": { "eslint": "~5.15", diff --git a/boilerplate/requirements.txt b/boilerplate/requirements.txt index a91c110..faec789 100644 --- a/boilerplate/requirements.txt +++ b/boilerplate/requirements.txt @@ -1 +1 @@ -noyainrain.micro ~= 0.44.0 +noyainrain.micro ~= 0.45.0 diff --git a/client/bind.js b/client/bind.js index 59943ba..e1306c4 100644 --- a/client/bind.js +++ b/client/bind.js @@ -435,6 +435,19 @@ micro.bind.transforms = { return micro.bind.transforms.format(ctx, n === 1 ? singular : plural, ...args); }, + /** + * Return a string representation of the given :class:`Date` *date*. + * + * Alternatively, *date* may be a string parsable by :class:`Date`. *format* is equivalent to + * the *options* argument of :meth:`Date.toLocaleString`. + */ + formatDate(ctx, date, format) { + if (typeof date === "string") { + date = new Date(date); + } + return date.toLocaleString("en", format); + }, + /** * Project *arr* into the DOM. * diff --git a/client/components/analytics.html b/client/components/analytics.html index 6443453..f9de12f 100644 --- a/client/components/analytics.html +++ b/client/components/analytics.html @@ -12,6 +12,36 @@