[Kimchi-devel] [PATCH v2] [Wok] Added util method for formatting timestamp as per locale.
Aline Manera
alinefm at linux.vnet.ibm.com
Mon Nov 7 12:31:43 UTC 2016
On 11/07/2016 04:47 AM, pkulkark at linux.vnet.ibm.com wrote:
> From: Pooja Kulkarni <pkulkark at linux.vnet.ibm.com>
>
> v2:
> Rebased to latest master
>
> Signed-off-by: Pooja Kulkarni <pkulkark at linux.vnet.ibm.com>
> ---
> ui/js/src/wok.utils.js | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/ui/js/src/wok.utils.js b/ui/js/src/wok.utils.js
> index 80bdb77..daa34c4 100644
> --- a/ui/js/src/wok.utils.js
> +++ b/ui/js/src/wok.utils.js
> @@ -258,6 +258,13 @@ wok.numberLocaleConverter = function numberConverter(number, locale){
> return number;
> }
>
> +wok.timestampConverter = function timestampconverter(timestamp, locale){
> + var dte = new Date(timestamp)
> + var options = { year: 'numeric', month: 'long'
Please, use numeric for month too.
> , day: 'numeric', hour: 'numeric',
> + minute: 'numeric', second: 'numeric', timeZoneName: 'short'};
> + return dte.toLocaleString(locale, options);
> +}
> +
> wok.localeConverters = {
> "date-locale-converter": {
> to: function(date){
More information about the Kimchi-devel
mailing list