forked from date-fns/date-fns
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test for formatISO in Asia/Kolkata TZ
- Loading branch information
Mikko Koponen
committed
Feb 6, 2020
1 parent
d0c0a15
commit c0f4396
Showing
3 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# The script runs formatISO in a non%60 timezone offset | ||
# | ||
# It's a part of the test process. | ||
|
||
set -ex | ||
|
||
export PATH="$(yarn bin):$PATH" | ||
export NODE_ENV=test | ||
|
||
env TZ=Asia/Kolkata babel-node ./test/formatISO/india.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import formatISO from '../../src/formatISO' | ||
import assert from 'assert' | ||
|
||
if (process.env.TZ !== 'Asia/Kolkata') | ||
throw new Error('The test must be run with TZ=Asia/Kolkata') | ||
|
||
if (parseInt(process.version.match(/^v(\d+)\./)[1]) < 10) | ||
throw new Error('The test must be run on Node.js version >= 10') | ||
|
||
assert.equal( | ||
formatISO(new Date(1986, 3, 4, 10, 33, 1)), | ||
'1986-04-04T10:33:01+05:30' | ||
) |