Skip to content

Commit

Permalink
Updated the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelverschoof committed Jan 30, 2021
1 parent 1e289db commit 3816d4a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
14 changes: 14 additions & 0 deletions README.md
Expand Up @@ -33,6 +33,7 @@ For example: `primetime(519998462003)` equals the date *1986-6-24 12:01:02.003 G
| `primetime().format('{WDD}, {MMMM} {DD}, {YY} @ {HH}:{mm}:{ss} {TZ}', 'nl-nl')` | Format the date to the provided format and user's locale | `dinsdag, juni 24, 1986 @ 12:01:02 UTC` |

### Comparing dates
If the date()

| Code | Description | Returns |
| --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | ------- |
Expand Down Expand Up @@ -65,6 +66,19 @@ These methods return the updated PrimeTime object, enabling method chaining.
| `primetime().clone('day')` | Creates a duplicate PrimeTime object with the year, month and day set | `PrimeTime` |
| `primetime().update(519998462003)` | Sets a new timestamp for the object | `PrimeTime` |

### Changing time zones

| Code | Description | Returns |
| ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| `primetime().timezone('Europe/Amsterdam')` | Sets the object as if it is in that timezone | `PrimeTime` |
| `primetime().timezone('Europe/Amsterdam').format('WDD, MMMM, DD, HH, mm, ss, TZZ')` | Format the date (in the chosen time zone) to the provided date parts and user's locale (en-US for example) | `Tuesday, 6/24/1986, 10:01:02 PM Coordinated Universal Time` |
| `primetime().timezone('America/New_York').localise('DD, MM, YY, HH, mm, ss', 'nl-nl', 'Europe/Amsterdam')` | Format the date (in the chosen time zone) to the provided date parts and user's locale (en-US for example) in another time zone | `24-06-1986 18:01:02` |
| `primetime().timezone('Europe/London').after(primetime().timezone('Europe/Amsterdam'))` | Check if the first date is after the second date, using their respective time zones | `true` |
| `primetime().timezone('Europe/London').before(primetime().timezone('Europe/Amsterdam'))` | Check if the first date is before the second date, using their respective time zones | `false` |
| `primetime().timezone('Europe/London').between(primetime().timezone('Europe/Amsterdam'), primetime().timezone('America/New_York'))` | Check if the first date is between the other dates, using their respective time zones | `true` |
| `primetime().timezone('Europe/London').equal(primetime().timezone('Europe/Amsterdam'))` | Check if the first date equals the second date, using their respective time zones | `false` |


## Why Prime Time?
Named after the [Alan Parsons Project][alan-parsons-project] song [Prime Time][youtube-video] from the album [Ammonia Avenue][ammonia-avenue].
This song is one of my personal favorites and its name fits this project quite well.
Expand Down
7 changes: 3 additions & 4 deletions src/lib/prime-time.ts
Expand Up @@ -48,7 +48,6 @@ export default class PrimeTime {

/* Comparisons */

// TODO tests with offset (opening hours)
difference (to : PrimeTime, timespan? : string | Timespan) : number {
const fromTimestamp = Timestamps.offset(this.timestamp, this.offset);
const toTimestamp = Timestamps.offset(to.timestamp, to.offset);
Expand Down Expand Up @@ -92,12 +91,12 @@ export default class PrimeTime {
return Format.customise(timestamp, format, locale, timezone);
}

utc () : string {
gmt () : string {
return Format.gmt(this.timestamp);
}

gmt () : string {
return Format.gmt(this.timestamp);
utc () : string {
return this.gmt();
}

/* Timezones */
Expand Down

0 comments on commit 3816d4a

Please sign in to comment.