This project adheres to Semantic Versioning.
Nothing for now.
Compare with last published version.
Compare with last published version.
- Add
setTzInRealWorldRange()
allowing to shift timezones to be inside the real-world (IANA) range. - Add
setTzConfig()
to set the timezone related configuration: pass it an object to set the timezone separator and enforce the IANA range at the same time.
- Improve multiple typing resolutions: previously, 1
.d.ts
file were generated by.js
file, preserving the initial folder structure. In both plain JavaScript and TypeScript environments, this was leading to quirks like:- types exported from subpath instead of root
- unexported functions being exported as types
Despite these, documented functions were properly exposed but global typing discoverability was a mess. See the comment in the related pull requests for more. This is now fixed by cleaning and combining all .d.ts
files into one thanks to dts-bundle-generator
.
- Fix documentation examples for
tzOffset
. - Rephrase some parts.
- And add more tests for
tzOffset
in order to strenghten. This will be useful for the work around the standardizedTemporal
API. - Update ESLint config to group
import
statements by source. - Change TypeScript
target
toESNExt
. - Rename some internals.
- Remove test files from published package.
Compare with previous version.
- Fix incorrect year for
datetime(date, 'week')
when the week started the previous year. For example,2021-01-01
is a Friday and its week belongs to 2020 (as per spec). In that case, the output was2021-W53
instead of2020-W53
.
- Improve type definitions where
?
andundefined
are redundant by removingundefined
:- for some signatures of optional parameters from
datetime(date?: Date | undefined
todatetime(date?: Date
- for some optional properties from
{ w?: number | undefined }
to{ w?: number }
- for some signatures of optional parameters from
- Use brotli compression instead of gzip one to express the module size.
- Enforce type definitions for optional properties of the internal config functions
setConfig
andsetTzConfig
: it was possible to omit theirseparator
property, it’s not anymore. - Upgrade ESLint from 8 to 9 and lint tests using
eslint-plugin-vitest
. - Split test file and move tests closer to the code.
Compare with previous version.
- Fix
.js
file extension missing in animport
statement when trying toimport { datetime }
, which worked in some bundlers but could fail in others or when not using any bundler. This issue was introduced in version 1.3.0.
- Fix typos.
- The NPM command to test types has been changed from
test-types
totest:types
. - Update tooling for Node 20.
- Configure the dependencies update automation to group them by categories.
- Monitor package size on pull request.
Compare with previous version.
- Shorten
daysBetween()
andDateTime
footprint by a couple of bytes.
Warning
When not transpiled, DateTime
now requires support for class
fields (Safari 14.0).
- Replace NPM by pnpm.
Compare with previous version.
- Typo (grammar) in types documentation.
- Add code of conduct, issue template, contributing guidelines, code analysis, dependabot, CodeQL.
- Replace Jest by Vitest.
Compare with previous version.
- Support years with more then 4 digits (
12345-01-01
). - Support years prior to year 1 (
-0051-01-01
). - Add
setTimeSeparator()
to customize the separator between date and time.
- Missing zero-padding in front of years with less then 4 digits (
0537-01-01
).
- Update bundle sizes and related links.
- Fix links in this changelog.
- Update development dependencies.
- Update
package.json
description and keywords fields. - Update GitHub actions.
Compare with previous.
- Add
setTzSeparator()
to customize the hours-minutes separator of timezone offsets. - Add a Precision type for the
precision
parameter ofdatetime
,datetimeTz
andDateTime.to
, and a subset of this new type forutc
. It autocompletes the parameter (in modern code editors) with the available keywords.
- Improve types generation.
Compare with previous.
- Add a
DateTime()
class extending the nativeDate
object. Available methods:getWeek()
,setWeek()
andto()
.
- Allow
datetimeTz()
without parameters. Before, the date was mandatory. - Improve types declaration.
- Add a NPM script to generate types.
- Update ESLint rules.
Compare with previous version.
The usage remains the same as in the previous version.
Compare with previous version.
- Forbid
null
as validduration()
argument:duration(null)
now throws an error.
- Add types for TypeScript users.
- Fix zero-seconds
duration()
returningnull
instead ofPT0S
.
Compare with previous version.
datetimeDuration()
has been renamedduration()
.
- Add
utc()
as a shortcut todatetime(myDateObject, 'datetime utc')
.
- The project now has an ESLint configuration.
Compare with previous version.
The day number in datetime()
and datetimeTz()
was wrong before the 10th of the month. For example, the 5th of July became 2021-07-5T
instead of 2021-07-5T
.
Compare with previous version.
tzOffset()
anddatetimeTz()
now adjust the timezone to fit the spec boundaries (from-23:59
to+23:59
). There was no limits before.
tzOffset()
now accepts a third parameter. When set totrue
, it enforce the provided timezone to stay in real-world boundaries (from-12:00
to+14:00
).- This also applies to
datetimeTz()
, which now accepts a fifth parameter to be on par with howtzOffset()
works.
Compare with previous version.
datetimeDuration()
now accepts a second parameter. When set tofalse
, overflow units won’t be converted anymore.
- Add a table of contents, summary usage and package size.
- Improve various parts of the documentation and the release notes.
Compare with previous version.
- Add
datetimeTz()
to indicate that adatetime
attribute belongs to the specified timezone offset.
- Rename
datetimeTz()
totzOffset()
Compare with previous version.
datetime()
:local
andglobal
precision keywords are nowdatetime
andutc
.
- Add
datetime()
missing global precisions.
Compare with previous version.
datetime()
without parameter is now accepted: instead of throwing an error it defaults to now with the default precision (YYYY-mm-dd
).
tzOffset()
to express timezone offsets
- Rewrite most of the documentation.
Compare with previous version.
- Shorten
datetimeDuration()
footprint by a couple of bytes.
- Fix duration datetime output in documentation.
Compare with previous version.
- Rewrite how
datetime()
works to shorten its footprint.
Compare with previous version.
- Mark the package as being side effects free.
First published version.