+++ /dev/null
-<?php
- //$tests = array('d','j','N','D','l','S','w','z','W','F','M','m','n','t','L','Y','y','a','A','B','g','G','h','H','i','s','I','O','P','Z','U');
- $tests = array('l (D) N w', 'F (M) n m [t]', 'z W', 'd jS', 'Y (y) L I', 'ga hA G (H)', 'i:s', 'B', 'O P Z', 'U');
- $headers = "<th>UTC</th>";
- $contents = "";
- for ($j = 1; $j < count($tests) + 1; $j++) {
- $a = $tests[$j-1];
- $headers .= "<th class='a'>$a</th>";
- }
- for ($i = 0; $i < 300; $i++) {
- //$date = round($i * 5482443);
- $date = round(1162277916 + $i * 1543);
- $oddrow = $i % 2 == 0 ? " class='odd'" : '';
- $contents .= "<tr$oddrow><td>$date</td>";
- for ($j = 0; $j < count($tests); $j++) {
- // set php date in seconds
- $phpoutput = date($tests[$j], round($date));
- // set js date in milliseconds
- $jsdate = $date * 1000;
- $contents .= "<td class='e' data-date='$jsdate' data-key='$tests[$j]' data-output='$phpoutput'>$phpoutput</td>";
- }
- $contents .= "</tr>";
- }
-?>
-
-<!DOCTYPE html>
-<html>
- <head>
- <title>phpdate</title>
- <style>
- table { width:100%; border-collapse:collapse; }
- tr.odd td { background:#eee; }
- td { padding:5px; margin:0; border-top:1px solid #bbb; }
- </style>
- <script src="vendor/jquery.js"></script>
- <script src="vendor/underscore.js"></script>
- <script src="../lib/underscore.date.js"></script>
- <script>
- var buggy = {};
- $(function(){
- $('td.e').each(function(){
- var t = $(this),
- date = t.data('date'),
- key = t.data('key'),
- fixKey = key.replace(/[^A-Za-z]/g, ""),
- val = t.data('output'),
- target = _.dateFormat(key,date);
- if (val == target){
- t.css('color','green');
- } else {
- t.css('color','red').html(val + ' <br/>' + target + '');
- buggy[fixKey] = buggy[fixKey] ? buggy[fixKey] + 1 : 1;
- }
- });
- $('th.a').each(function(){
- var t = $(this),
- key = t.text().replace(/[^A-Za-z]/g, "");
- if (!buggy[key]){
- t.css('color','green');
- } else {
- t.css('color','red').html(t.text() + '(' + buggy[key] + ')');
- }
- });
- });
- </script>
- </head>
- <body>
- <table style="width:100%;">
- <tr><?php print($headers); ?></tr>
- <?php print($contents); ?>
- </table>
- </body>
-</html>
\ No newline at end of file
+++ /dev/null
-$(document).ready(function() {
-
- module("Time");
-
-
-
-});
+++ /dev/null
-<script src="../vendor/underscore.js"></script>
-<script src="../../lib/underscore.date.js"></script>
-<script src="../vendor/jslitmus.js"></script>
-<script>
- var tests = "ABDFGHILMNOPSUWYZadghijlmnstwyz".split('');
- _.each(tests, function(a){
- JSLitmus.test(a, function() {
- return _.dateFormat(a);
- });
- });
-</script>
+++ /dev/null
-<script src="../vendor/JSLitmus.js"></script>
-
-<script>
-
- function leftZeroFill1(number, targetLength) {
- var output = number + '';
- while (output.length < targetLength) {
- output = '0' + output;
- }
- return output;
- };
-
- function leftZeroFill2(number, targetLength) {
- if ((number = number + "").length < targetLength) {
- return new Array((++targetLength) - number.length).join("0") + number;
- } else {
- return number;
- }
- }
-
- JSLitmus.test('leftZeroFill 1 1e2, 2', function() {
- leftZeroFill1(Math.floor(Math.random() * 1e2) ,2);
- });
- JSLitmus.test('leftZeroFill 2 1e2, 2', function() {
- leftZeroFill2(Math.floor(Math.random() * 1e2) ,2);
- });
- JSLitmus.test('leftZeroFill 1 1e5, 5', function() {
- leftZeroFill1(Math.floor(Math.random() * 1e5) ,5);
- });
- JSLitmus.test('leftZeroFill 2 1e5, 5', function() {
- leftZeroFill2(Math.floor(Math.random() * 1e5) ,5);
- });
- JSLitmus.test('leftZeroFill 1 1e9, 9', function() {
- leftZeroFill1(Math.floor(Math.random() * 1e9) ,9);
- });
- JSLitmus.test('leftZeroFill 2 1e9, 9', function() {
- leftZeroFill2(Math.floor(Math.random() * 1e9) ,9);
- });
- JSLitmus.test('leftZeroFill 1 1e30, 30', function() {
- leftZeroFill1(Math.floor(Math.random() * 1e30) ,30);
- });
- JSLitmus.test('leftZeroFill 2 1e30, 30', function() {
- leftZeroFill2(Math.floor(Math.random() * 1e30) ,30);
- });
-
-</script>
+++ /dev/null
-<script src="../vendor/JSLitmus.js"></script>
-
-<script>
-
- function bitwiseOrFloor(number) {
- return number | 0;
- };
-
- function parseIntFloor(number) {
- return parseInt(number);
- };
-
- function MathFloor(number) {
- return Math.floor(number);
- };
-
- function bitwiseOrRound(number) {
- return number + .5 | 0;
- };
-
- function parseIntRound(number) {
- return parseInt(number + .5);
- };
-
- function MathRound(number) {
- return Math.round(number);
- };
-
- JSLitmus.test('bitwiseOrFloor', function() {
- bitwiseOrFloor(Math.random()*10);
- });
-
- JSLitmus.test('parseIntFloor', function() {
- parseIntFloor(Math.random()*10);
- });
-
- JSLitmus.test('MathFloor', function() {
- MathFloor(Math.random()*10);
- });
-
- JSLitmus.test('bitwiseOrRound', function() {
- bitwiseOrRound(Math.random()*10);
- });
-
- JSLitmus.test('parseIntRound', function() {
- parseIntRound(Math.random()*10);
- });
-
- JSLitmus.test('MathRound', function() {
- MathRound(Math.random()*10);
- });
-
-</script>
+++ /dev/null
-<script src="../vendor/jslitmus.js"></script>
-<script>
- var charactersToReplace = /[a-z][0-9]?/gi;
- formatFunctions = {
- L:function(){},
- l:function(){}
- };
-
- function replaceFunction1(input) {
- var character = input.charAt(0),
- parameter = input.length > 1 ? input.charAt(1) | 0 : 0;
- return formatFunctions[character] ? formatFunctions[character](parameter & 1, parameter >> 1) : input;
- };
-
- function replaceFunction2(input) {
- var character = input.charAt(0),
- parameter = input.charAt(1) || 0;
- return formatFunctions[character] ? formatFunctions[character](parameter & 1, parameter >> 1) : input;
- };
-
- function replaceFunction3(input) {
- var character = input.split('');
- return formatFunctions[character[0]] ? formatFunctions[character[0]](character[1] | 0 & 1, character[1] | 0 >> 1) : input;
- };
-
-
-
- JSLitmus.test('replaceFunction1', function() {
- return "0L L+ l l- 0D D+ W W+ w w- y 0y h h+ H H+ m 0m s 0s".replace(charactersToReplace, replaceFunction1);
- });
-
- JSLitmus.test('replaceFunction2', function() {
- return "0L L+ l l- 0D D+ W W+ w w- y 0y h h+ H H+ m 0m s 0s".replace(charactersToReplace, replaceFunction2);
- });
-
- JSLitmus.test('replaceFunction3', function() {
- return "0L L+ l l- 0D D+ W W+ w w- y 0y h h+ H H+ m 0m s 0s".replace(charactersToReplace, replaceFunction3);
- });
-
-</script>
\ No newline at end of file
+++ /dev/null
-<script src="../vendor/jslitmus.js"></script>
-<script>
- var charactersToReplace = /[a-z]/gi,
- formatFunctions = {
- a:function(){
- return '1';
- },
- b:function(){
- return '2';
- },
- c:function(){
- return '3';
- },
- d:function(){
- return '4';
- },
- e:function(){
- return '5';
- },
- f:function(){
- return '6';
- },
- g:function(){
- return '7';
- }
- };
-
- function replaceFunction1(input) {
- return formatFunctions[input] ? formatFunctions[input]() : input;
- }
-
- function replaceFunction2(input) {
- switch (input) {
- case 'a':
- return '1';
- case 'b':
- return '2';
- case 'c':
- return '3';
- case 'd':
- return '4';
- case 'e':
- return '5';
- case 'f':
- return '6';
- case 'g':
- return '7';
- default:
- return'0';
- }
- }
-
- JSLitmus.test('replaceFunction1', function() {
- return "abcdefg".replace(charactersToReplace, replaceFunction1);
- });
-
- JSLitmus.test('replaceFunction2', function() {
- return "abcdefg".replace(charactersToReplace, replaceFunction2);
- });
-
-</script>
\ No newline at end of file
+++ /dev/null
-$(document).ready(function() {
-
-
-
-});