Skip to content

Commit

Permalink
Fix #24: Correct date format error for characters containing T
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Apr 14, 2020
1 parent 582b196 commit 82b61cd
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Change Log: `php-date-formatter`
================================

## Version 1.3.6

**Date:** 14-Apr-2020

- (enh #24): Correct date format error for characters containing `T`.

## Version 1.3.5

**Date:** 13-Jul-2018
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 - 2018, Kartik Visweswaran
Copyright (c) 2014 - 2020, Kartik Visweswaran
Krajee.com
All rights reserved.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ server side and client side validation should help in building extensible applic

This library is a standalone javascript library and does not depend on other libraries or plugins like jQuery.

The latest release of the library is v1.3.5. Check the [CHANGE LOG](https://github.com/kartik-v/php-date-formatter/blob/master/CHANGE.md) for details.
The latest release of the library is v1.3.6. Check the [CHANGE LOG](https://github.com/kartik-v/php-date-formatter/blob/master/CHANGE.md) for details.

## Features

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "php-date-formatter",
"version": "1.3.5",
"version": "1.3.6",
"homepage": "https://github.com/kartik-v/php-date-formatter",
"authors": [
"Kartik Visweswaran <kartikv2@gmail.com>"
Expand Down
12 changes: 6 additions & 6 deletions js/php-date-formatter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2018
* @version 1.3.5
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2020
* @version 1.3.6
*
* Date formatter utility library that allows formatting date/time variables or Date objects using PHP DateTime format.
* This library is a standalone javascript library and does not depend on other libraries or plugins like jQuery. The
Expand Down Expand Up @@ -48,14 +48,14 @@
return Math.floor(number % 100 / 10) === 1 || !suffixes[n] ? 'th' : suffixes[n];
}
},
separators: /[ \-+\/.T:@]/g,
separators: /[ \-+\/.:@]/g,
validParts: /[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,
intParts: /[djwNzmnyYhHgGis]/g,
tzParts: /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
tzClip: /[^-+\dA-Z]/g
},
compare: function (str1, str2) {
return typeof(str1) === 'string' && typeof(str2) === 'string' && str1.toLowerCase() === str2.toLowerCase();
return typeof (str1) === 'string' && typeof (str2) === 'string' && str1.toLowerCase() === str2.toLowerCase();
},
lpad: function (value, length, chr) {
var val = value.toString();
Expand Down Expand Up @@ -144,7 +144,7 @@
}
vFormatParts = vFormat.match(self.validParts);
if (!vFormatParts || vFormatParts.length === 0) {
throw new Error("Invalid date format definition.");
throw new Error('Invalid date format definition.');
}
for (i = vFormatParts.length - 1; i >= 0; i--) {
if (vFormatParts[i] === 'S') {
Expand Down Expand Up @@ -578,7 +578,7 @@
* @return {string}
*/
T: function () {
var str = (String(vDate).match(self.tzParts) || [""]).pop().replace(self.tzClip, "");
var str = (String(vDate).match(self.tzParts) || ['']).pop().replace(self.tzClip, '');
return str || 'UTC';
},
/**
Expand Down
6 changes: 3 additions & 3 deletions js/php-date-formatter.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "php-date-formatter",
"version": "1.3.5",
"version": "1.3.6",
"description": "A Javascript datetime formatting and manipulation library using PHP date-time formats.",
"main": "js/php-date-formatter.js",
"directories": {
Expand Down

0 comments on commit 82b61cd

Please sign in to comment.