Yahoo! WidgetのJavaScriptは、日付周りの多言語対応がないようです。 本来のJavaScriptにはtoLocaleString()命令があることになっていますが、4.0では変換されず、そのまま英語の日付が出力されます。

これに対処するには、prototypeという命令を使い、Dateオブジェクトに toLocaleString という関数を追加します。以下の例は実行環境が日本語だと仮定しています。

Date.prototype.toLocaleString = function (){
   Print("toLocaleString");
   return this.getFullYear()+'年'+
     (this.getMonth()+1)+'月'+
     this.getDate()+'日'+
     this.getHours()+'時'+
     this.getMinutes()+'分'+
     this.getSeconds()+'秒';
}

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-71) was last changed on 12-Aug-2009 23:09 by kei