Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 1746048f
authored
Apr 15, 2016
by
Will Anderson
Committed by
Jan Aagaard Meier
Apr 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utcOffset fix (#5588)
1 parent
6a6be9e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
lib/data-types.js
lib/data-types.js
View file @
1746048
...
...
@@ -7,7 +7,8 @@ var util = require('util')
,
sequelizeErrors
=
require
(
'./errors'
)
,
warnings
=
{}
,
Validator
=
require
(
'validator'
)
,
moment
=
require
(
'moment-timezone'
);
,
momentTz
=
require
(
'moment-timezone'
)
,
moment
=
require
(
'moment'
);
/**
* A convenience class holding commonly used data types. The datatypes are used when defining a new model using `Sequelize.define`, like this:
...
...
@@ -463,14 +464,14 @@ DATE.prototype.validate = function(value) {
};
DATE
.
prototype
.
$applyTimezone
=
function
(
date
,
options
)
{
date
=
moment
(
date
);
if
(
options
.
timezone
)
{
if
(
moment
.
tz
.
zone
(
options
.
timezone
))
{
date
=
date
.
tz
(
options
.
timezone
);
if
(
moment
Tz
.
tz
.
zone
(
options
.
timezone
))
{
date
=
momentTz
(
date
)
.
tz
(
options
.
timezone
);
}
else
{
date
=
date
.
utcOffset
(
options
.
timezone
);
date
=
moment
(
date
)
.
utcOffset
(
options
.
timezone
);
}
}
else
{
date
=
momentTz
(
date
);
}
return
date
;
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment