data tables are going to need some work yet, but the other stuff seems to be working 100%
246 lines
9.3 KiB
HTML
246 lines
9.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
<html>
|
|
<head>
|
|
<title>API: datasource YAHOO.util.DateLocale (YUI Library)</title>
|
|
<link rel="stylesheet" type="text/css" href="assets/api.css">
|
|
<script type="text/javascript" src="assets/api-js"></script>
|
|
<script type="text/javascript" src="assets/ac-js"></script>
|
|
</head>
|
|
|
|
<body id="yahoo-com">
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
|
|
<div id="hd">
|
|
<a href="http://developer.yahoo.com/yui/"><h1>Yahoo! UI Library</h1></a>
|
|
<h3>DataSource Utility <span class="subtitle">2.6.0</span></h3>
|
|
<p>
|
|
<a href="./index.html">Yahoo! UI Library</a>
|
|
> <a href="./module_datasource.html">datasource</a>
|
|
> YAHOO.util.DateLocale
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
|
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
<form name="yui-classopts-form">
|
|
<span id="classopts"><input type="checkbox" name="showprivate" id="showprivate" /> <label for="showprivate">Show Private</label></span>
|
|
<span id="classopts"><input type="checkbox" name="showprotected" id="showprotected" /> <label for="showprotected">Show Protected</label></span>
|
|
<span id="classopts"><input type="checkbox" name="showdeprecated" id="showdeprecated" /> <label for="showdeprecated">Show Deprecated</label></span>
|
|
</form>
|
|
|
|
<h2>
|
|
|
|
|
|
|
|
|
|
Class <b>YAHOO.util.DateLocale</b>
|
|
<span class="extends">
|
|
</span>
|
|
|
|
<span class="extends">
|
|
</span>
|
|
|
|
</code>
|
|
</h2>
|
|
<!-- class tree goes here -->
|
|
|
|
|
|
|
|
|
|
<div class="summary description">
|
|
The DateLocale class is a container and base class for all
|
|
localised date strings used by YAHOO.util.Date. It is used
|
|
internally, but may be extended to provide new date localisations.
|
|
To create your own DateLocale, follow these steps:
|
|
<ol>
|
|
<li>Find an existing locale that matches closely with your needs</li>
|
|
<li>Use this as your base class. Use YAHOO.util.DateLocale if nothing
|
|
matches.</li>
|
|
<li>Create your own class as an extension of the base class using
|
|
YAHOO.lang.merge, and add your own localisations where needed.</li>
|
|
</ol>
|
|
See the YAHOO.util.DateLocale['en-US'] and YAHOO.util.DateLocale['en-GB']
|
|
classes which extend YAHOO.util.DateLocale['en'].
|
|
For example, to implement locales for French french and Canadian french,
|
|
we would do the following:
|
|
<ol>
|
|
<li>For French french, we have no existing similar locale, so use
|
|
YAHOO.util.DateLocale as the base, and extend it:
|
|
<pre>
|
|
YAHOO.util.DateLocale['fr'] = YAHOO.lang.merge(YAHOO.util.DateLocale, {
|
|
a: ['dim', 'lun', 'mar', 'mer', 'jeu', 'ven', 'sam'],
|
|
A: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
|
|
b: ['jan', 'fév', 'mar', 'avr', 'mai', 'jun', 'jui', 'aoû', 'sep', 'oct', 'nov', 'déc'],
|
|
B: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
|
|
c: '%a %d %b %Y %T %Z',
|
|
p: ['', ''],
|
|
P: ['', ''],
|
|
x: '%d.%m.%Y',
|
|
X: '%T'
|
|
});
|
|
</pre>
|
|
</li>
|
|
<li>For Canadian french, we start with French french and change the meaning of \%x:
|
|
<pre>
|
|
YAHOO.util.DateLocale['fr-CA'] = YAHOO.lang.merge(YAHOO.util.DateLocale['fr'], {
|
|
x: '%Y-%m-%d'
|
|
});
|
|
</pre>
|
|
</li>
|
|
</ol>
|
|
With that, you can use your new locales:
|
|
<pre>
|
|
var d = new Date("2008/04/22");
|
|
YAHOO.util.Date.format(d, {format: "%A, %d %B == %x"}, "fr");
|
|
</pre>
|
|
will return:
|
|
<pre>
|
|
mardi, 22 avril == 22.04.2008
|
|
</pre>
|
|
And
|
|
<pre>
|
|
YAHOO.util.Date.format(d, {format: "%A, %d %B == %x"}, "fr-CA");
|
|
</pre>
|
|
Will return:
|
|
<pre>
|
|
mardi, 22 avril == 2008-04-22
|
|
</pre>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="yui-b">
|
|
<div class="nav">
|
|
|
|
<div class="module">
|
|
<h4>Modules</h4>
|
|
<ul class="content">
|
|
|
|
<li class=""><a href="module_animation.html">animation</a></li>
|
|
|
|
<li class=""><a href="module_autocomplete.html">autocomplete</a></li>
|
|
|
|
<li class=""><a href="module_button.html">button</a></li>
|
|
|
|
<li class=""><a href="module_calendar.html">calendar</a></li>
|
|
|
|
<li class=""><a href="module_carousel.html">carousel</a></li>
|
|
|
|
<li class=""><a href="module_charts.html">charts</a></li>
|
|
|
|
<li class=""><a href="module_colorpicker.html">colorpicker</a></li>
|
|
|
|
<li class=""><a href="module_connection.html">connection</a></li>
|
|
|
|
<li class=""><a href="module_container.html">container</a></li>
|
|
|
|
<li class=""><a href="module_cookie.html">cookie</a></li>
|
|
|
|
<li class="selected"><a href="module_datasource.html">datasource</a></li>
|
|
|
|
<li class=""><a href="module_datatable.html">datatable</a></li>
|
|
|
|
<li class=""><a href="module_dom.html">dom</a></li>
|
|
|
|
<li class=""><a href="module_dragdrop.html">dragdrop</a></li>
|
|
|
|
<li class=""><a href="module_editor.html">editor</a></li>
|
|
|
|
<li class=""><a href="module_element.html">element</a></li>
|
|
|
|
<li class=""><a href="module_event.html">event</a></li>
|
|
|
|
<li class=""><a href="module_get.html">get</a></li>
|
|
|
|
<li class=""><a href="module_history.html">history</a></li>
|
|
|
|
<li class=""><a href="module_imagecropper.html">imagecropper</a></li>
|
|
|
|
<li class=""><a href="module_imageloader.html">imageloader</a></li>
|
|
|
|
<li class=""><a href="module_json.html">json</a></li>
|
|
|
|
<li class=""><a href="module_layout.html">layout</a></li>
|
|
|
|
<li class=""><a href="module_logger.html">logger</a></li>
|
|
|
|
<li class=""><a href="module_menu.html">menu</a></li>
|
|
|
|
<li class=""><a href="module_paginator.html">paginator</a></li>
|
|
|
|
<li class=""><a href="module_profiler.html">profiler</a></li>
|
|
|
|
<li class=""><a href="module_profilerviewer.html">profilerviewer</a></li>
|
|
|
|
<li class=""><a href="module_resize.html">resize</a></li>
|
|
|
|
<li class=""><a href="module_selector.html">selector</a></li>
|
|
|
|
<li class=""><a href="module_slider.html">slider</a></li>
|
|
|
|
<li class=""><a href="module_tabview.html">tabview</a></li>
|
|
|
|
<li class=""><a href="module_treeview.html">treeview</a></li>
|
|
|
|
<li class=""><a href="module_uploader.html">uploader</a></li>
|
|
|
|
<li class=""><a href="module_yahoo.html">yahoo</a></li>
|
|
|
|
<li class=""><a href="module_yuiloader.html">yuiloader</a></li>
|
|
|
|
<li class=""><a href="module_yuitest.html">yuitest</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="module">
|
|
<h4>Classes</h4>
|
|
<ul class="content">
|
|
<li class=""><a href="YAHOO.util.DataSource.html">YAHOO.util.DataSource</a></li>
|
|
<li class=""><a href="YAHOO.util.DataSourceBase.html">YAHOO.util.DataSourceBase</a></li>
|
|
<li class=""><a href="YAHOO.util.Date.html">YAHOO.util.Date</a></li>
|
|
<li class="selected"><a href="YAHOO.util.DateLocale.html">YAHOO.util.DateLocale</a></li>
|
|
<li class=""><a href="YAHOO.util.FunctionDataSource.html">YAHOO.util.FunctionDataSource</a></li>
|
|
<li class=""><a href="YAHOO.util.LocalDataSource.html">YAHOO.util.LocalDataSource</a></li>
|
|
<li class=""><a href="YAHOO.util.Number.html">YAHOO.util.Number</a></li>
|
|
<li class=""><a href="YAHOO.util.ScriptNodeDataSource.html">YAHOO.util.ScriptNodeDataSource</a></li>
|
|
<li class=""><a href="YAHOO.util.XHRDataSource.html">YAHOO.util.XHRDataSource</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="module">
|
|
<h4>Files</h4>
|
|
<ul class="content">
|
|
<li class=""><a href="DataSource.js.html">DataSource.js</a></li>
|
|
<li class=""><a href="Type.js.html">Type.js</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="ft">
|
|
<hr />
|
|
Copyright © 2008 Yahoo! Inc. All rights reserved.
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|