Skip to content

Commit

Permalink
Fix default (ISO8601 style) date for formatDate to respect client tim…
Browse files Browse the repository at this point in the history
…ezone
  • Loading branch information
mbrookes committed Dec 1, 2015
1 parent 4748c20 commit 43f4955
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,5 +1,6 @@
## Changelog

* 0.3.3 Fix default (ISO8601 style) date for formatDate to respect client timezone
* 0.3.2 Remove explicit files declaration from package.json (the npm docs lie!)
* 0.3.1 Add ./lib/ to package.json.
* 0.3.0 Split into separate files to allow individual import of MUI components
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "formsy-material-ui",

"version": "0.3.2",
"version": "0.3.3",
"description": "A formsy-react compatibility wrapper for Material-UI form components.",
"main": "index.js",

Expand Down
8 changes: 6 additions & 2 deletions src/FormsyDate.jsx
Expand Up @@ -9,9 +9,13 @@ let FormsyDate = React.createClass({
render: function () {
return (
<DatePicker
formatDate={(date) => date.toISOString().substring(0,10)}
// Sets the default date format to be ISO8601 (YYYY-MM-DD), accounting for current timezone
formatDate={(date) => (new Date(date.toDateString()+" 12:00:00 +0000")).toISOString().substring(0,10)}
{...this.props}
onChange={this.handleValueChange} />
defaultValue={this.props.value}
onChange={this.handleValueChange}
errorText={this.getErrorMessage()}
value={this.getValue()} />
);
}
});
Expand Down

0 comments on commit 43f4955

Please sign in to comment.