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.tsfile were generated by.jsfile, 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
tzOffsetin order to strenghten. This will be useful for the work around the standardizedTemporalAPI. - Update ESLint config to group
importstatements by source. - Change TypeScript
targettoESNExt. - 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-01is a Friday and its week belongs to 2020 (as per spec). In that case, the output was2021-W53instead of2020-W53.
- Improve type definitions where
?andundefinedare redundant by removingundefined:- for some signatures of optional parameters from
datetime(date?: Date | undefinedtodatetime(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
setConfigandsetTzConfig: it was possible to omit theirseparatorproperty, 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
.jsfile extension missing in animportstatement 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-typestotest: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()andDateTimefootprint 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.jsondescription 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
precisionparameter ofdatetime,datetimeTzandDateTime.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 nativeDateobject. 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
nullas validduration()argument:duration(null)now throws an error.
- Add types for TypeScript users.
- Fix zero-seconds
duration()returningnullinstead 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:59to+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:00to+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 adatetimeattribute belongs to the specified timezone offset.
- Rename
datetimeTz()totzOffset()
Compare with previous version.
datetime():localandglobalprecision keywords are nowdatetimeandutc.
- 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.