Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Protocol v7 and Timezone #53

Merged
merged 8 commits into from
Jun 26, 2017
Merged

Conversation

hun-a
Copy link
Contributor

@hun-a hun-a commented Apr 10, 2017

This PR related with issue #52.

I changed PROTOCOL_V6 to PROTOCOL_V7 and implemented the Timezone.

Default Date of javascript contains local timezone offset and automatically transform the Date as local timezone when you call the method of toString or etc.
As above reason, Timezone result was not same as CSQL interpreter.
So, I created Timezone.js module for handling CUBRID Timezone types that based moment-timezone API.
Timezone module contains format() method that could print as custom format like TO_CHAR(date_time) of CUBRID.

For example:

const Timezone = require('./Timezone');

const date = new Date(Date.UTC(2017, 3, 5, 16, 30, 30, 300));
const timezone = 'Asia/Seoul KST';

const timezoneData = new Timezone(date, timezone);
console.log(date);
console.log(timezoneData.format('YYYY-MM-DD HH24:MI:SS.FF TZD TZH:TZM'));
console.log(timezoneData.format('DY, DD MON YYYY HH24:MI:SS.FF GMT TZH:TZM'));
console.log(timezoneData.format('YYYY-MM-DD'));
console.log(timezoneData.format('HH24:MI:SS.FF'));

result:

2017-04-05T16:30:30.300Z
2017-04-05 16:30:30.300 KST +09:00
Wed, 05 Apr 2017 16:30:30.300 GMT +09:00
2017-04-05
16:30:30.300

Please check my PR and review. Thank you 😄

@kadishmal
Copy link
Contributor

kadishmal commented Apr 10, 2017

I will review the code soon. May take some time as the PR seems to be big.

@kisoo-han kisoo-han merged commit 4c6e4b4 into CUBRID:develop Jun 26, 2017
@hun-a hun-a deleted the protocol_v7 branch August 21, 2017 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants