summaryrefslogtreecommitdiff
path: root/date-fns/test/formatRFC3339/poland.js
diff options
context:
space:
mode:
Diffstat (limited to 'date-fns/test/formatRFC3339/poland.js')
-rw-r--r--date-fns/test/formatRFC3339/poland.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/date-fns/test/formatRFC3339/poland.js b/date-fns/test/formatRFC3339/poland.js
new file mode 100644
index 0000000..85c9048
--- /dev/null
+++ b/date-fns/test/formatRFC3339/poland.js
@@ -0,0 +1,31 @@
+import formatRFC3339 from '../../src/formatRFC3339'
+import assert from 'assert'
+
+/**
+ * Europe/Warsaw (Poland) is regular full-hours timezone
+ */
+if (process.env.TZ !== 'Europe/Warsaw')
+ throw new Error(
+ 'The test must be run with TZ=Europe/Warsaw (UTC+02:00 or UTC+01:00)'
+ )
+
+if (parseInt(process.version.match(/^v(\d+)\./)[1]) < 10)
+ throw new Error('The test must be run on Node.js version >= 10')
+
+// Old date
+assert.equal(
+ formatRFC3339(new Date(1986, 3, 4, 10, 33, 1)),
+ '1986-04-04T10:33:01+02:00'
+)
+
+// Standard time (Warsaw have +01:00)
+assert.equal(
+ formatRFC3339(new Date(2020, 0, 23, 5, 0, 54)),
+ '2020-01-23T05:00:54+01:00'
+)
+
+// Summer time (Warsaw have +02:00)
+assert.equal(
+ formatRFC3339(new Date(2020, 6, 30, 20, 59, 1)),
+ '2020-07-30T20:59:01+02:00'
+)