Skip to content

Commit

Permalink
Merge pull request #4 from burhanahmeed/v2.0.1-add-daylightsaving
Browse files Browse the repository at this point in the history
V2.0.1 add daylightsaving
  • Loading branch information
burhanahmeed authored Jun 14, 2020
2 parents 3f3bbe0 + 7d5ff4f commit a234709
Show file tree
Hide file tree
Showing 8 changed files with 2,750 additions and 1,061 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@



#### Version: Time.ts v2.0.0
#### Version: Time.ts v2.0.1
Please refers to [Time.ts v1.0.0](https://github.com/burhanahmeed/time.ts/tree/v1.0.0) if still using the old version.

changelogs:
- Add daylight saving time

## Deno
- [Deno.land third party module](https://deno.land/x/time.ts)

Expand All @@ -27,15 +30,15 @@ import { Time, timezone } from "https://deno.land/x/time.ts/mod.ts";

**More safe import**
```typescript
import { Time, timezone } from "https://denopkg.com/burhanahmeed/time.ts@v2.0.0/mod.ts";
import { Time, timezone } from "https://denopkg.com/burhanahmeed/time.ts@v2.0.1/mod.ts";
```
or
```typescript
import { Time, timezone } from "https://deno.land/x/time.ts@v2.0.0/mod.ts";
import { Time, timezone } from "https://deno.land/x/time.ts@v2.0.1/mod.ts";
```
or
```typescript
import { Time, timezone } from "https://denoland.id/x/time.ts@v2.0.0/mod.ts";
import { Time, timezone } from "https://denoland.id/x/time.ts@v2.0.1/mod.ts";
```

## API
Expand All @@ -47,7 +50,7 @@ Here is a basic example to get started with Time.ts

Check this out on [Example directory](https://github.com/burhanahmeed/time.ts/tree/master/example).
```typescript
import { Time } from "https://denopkg.com/burhanahmeed/time.ts@v2.0.0/mod.ts";
import { Time } from "https://denopkg.com/burhanahmeed/time.ts@v2.0.1/mod.ts";

console.log('Time now UTC: ',time().t)
//Time now UTC: 2020-06-14T06:19:37.483Z
Expand Down Expand Up @@ -79,7 +82,7 @@ console.log('Time now of your server timezone: ',time().now())
```
If you want to get the list of available timezone you can do like this.
```typescript
import { timezone } from "https://denopkg.com/burhanahmeed/time.ts@v2.0.0/mod.ts";
import { timezone } from "https://denopkg.com/burhanahmeed/time.ts@v2.0.1/mod.ts";

console.log(timezone)
/**
Expand Down
32 changes: 24 additions & 8 deletions example/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
import { Time, timezone } from "https://denopkg.com/burhanahmeed/time.ts@v1.0.0/mod.ts";
import { time } from "../mod.ts";

console.log('Jakarta Timezone: ', new Time().timezone('Asia/Jakarta'))
console.log('Singapore Timezone: ', new Time().timezone('Asia/Singapore'))
console.log('Time now UTC: ',time().t)
//Time now UTC: 2020-06-14T06:19:37.483Z

console.log('Jakarta Timezone: ', new Time('2020-06-06 14:33:12').timezone('Asia/Jakarta'))
console.log('Singapore Timezone: ', new Time('2020-06-06 14:33:12').timezone('Asia/Singapore'))
console.log('Time now Singapore: ',time().tz('asia/singapore').t)
//Time now Singapore: 2020-06-14T14:19:37.483Z

console.log('UTC timezone: ', new Time().utc)
console.log('Now timezone: ', new Time().now)
console.log('Time now New York: ',time().tz('America/New_york').t)
//Time now New York: 2020-06-14T01:19:37.484Z

console.log(timezone)
console.log('Time now Jakarta: ',time().tz('asia/Jakarta').t)
//Time now Jakarta: 2020-06-14T13:19:37.484Z

console.log('Time now UTC string: ',time().toString())
//Time now UTC string: Sun, 14 Jun 2020 06:21:21 GMT

console.log('Time now UTC: ',time('2020-06-09 09:19').t)
//Time now UTC: 2020-06-09T02:19:00.000Z

console.log('Time now Singapore: ',time('2020-06-09 09:19').tz('asia/singapore').t)
//Time now Singapore: 2020-06-09T10:19:00.000Z

console.log('Time now UTC another way: ',time().tz('utc').t)
//Time now UTC another way: 2020-06-14T06:34:19.344Z

console.log('Time now of your server timezone: ',time().now())
//Time now of your server timezone: 2020-06-14T13:35:17.927Z
28 changes: 0 additions & 28 deletions example/main.ts

This file was deleted.

Loading

0 comments on commit a234709

Please sign in to comment.