@wisemen/datewise 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +307 -0
- package/dist/common/constants.d.ts +9 -0
- package/dist/common/constants.js +10 -0
- package/dist/common/constants.js.map +1 -0
- package/dist/common/date-period.enum.d.ts +7 -0
- package/dist/common/date-period.enum.js +15 -0
- package/dist/common/date-period.enum.js.map +1 -0
- package/dist/common/exhaustive-check.helper.d.ts +1 -0
- package/dist/common/exhaustive-check.helper.js +4 -0
- package/dist/common/exhaustive-check.helper.js.map +1 -0
- package/dist/common/inclusivity.d.ts +8 -0
- package/dist/common/inclusivity.js +23 -0
- package/dist/common/inclusivity.js.map +1 -0
- package/dist/common/index.d.ts +4 -0
- package/dist/common/index.js +5 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/init-dayjs.d.ts +1 -0
- package/dist/common/init-dayjs.js +31 -0
- package/dist/common/init-dayjs.js.map +1 -0
- package/dist/common/month.d.ts +15 -0
- package/dist/common/month.js +21 -0
- package/dist/common/month.js.map +1 -0
- package/dist/common/timezone.d.ts +600 -0
- package/dist/common/timezone.js +614 -0
- package/dist/common/timezone.js.map +1 -0
- package/dist/common/typeorm/adjacent-to.d.ts +5 -0
- package/dist/common/typeorm/adjacent-to.js +7 -0
- package/dist/common/typeorm/adjacent-to.js.map +1 -0
- package/dist/common/typeorm/ends-before.d.ts +5 -0
- package/dist/common/typeorm/ends-before.js +7 -0
- package/dist/common/typeorm/ends-before.js.map +1 -0
- package/dist/common/typeorm/index.d.ts +10 -0
- package/dist/common/typeorm/index.js +11 -0
- package/dist/common/typeorm/index.js.map +1 -0
- package/dist/common/typeorm/is-preceded-by.d.ts +5 -0
- package/dist/common/typeorm/is-preceded-by.js +7 -0
- package/dist/common/typeorm/is-preceded-by.js.map +1 -0
- package/dist/common/typeorm/is-succeeded-by.d.ts +5 -0
- package/dist/common/typeorm/is-succeeded-by.js +7 -0
- package/dist/common/typeorm/is-succeeded-by.js.map +1 -0
- package/dist/common/typeorm/overlaps-with.d.ts +5 -0
- package/dist/common/typeorm/overlaps-with.js +7 -0
- package/dist/common/typeorm/overlaps-with.js.map +1 -0
- package/dist/common/typeorm/precedes.d.ts +5 -0
- package/dist/common/typeorm/precedes.js +7 -0
- package/dist/common/typeorm/precedes.js.map +1 -0
- package/dist/common/typeorm/starts-after.d.ts +5 -0
- package/dist/common/typeorm/starts-after.js +7 -0
- package/dist/common/typeorm/starts-after.js.map +1 -0
- package/dist/common/typeorm/strictly-left-of.d.ts +5 -0
- package/dist/common/typeorm/strictly-left-of.js +7 -0
- package/dist/common/typeorm/strictly-left-of.js.map +1 -0
- package/dist/common/typeorm/strictly-right-of.d.ts +5 -0
- package/dist/common/typeorm/strictly-right-of.js +7 -0
- package/dist/common/typeorm/strictly-right-of.js.map +1 -0
- package/dist/common/typeorm/succeeds.d.ts +5 -0
- package/dist/common/typeorm/succeeds.js +7 -0
- package/dist/common/typeorm/succeeds.js.map +1 -0
- package/dist/date-range/date-range-errors.d.ts +9 -0
- package/dist/date-range/date-range-errors.js +17 -0
- package/dist/date-range/date-range-errors.js.map +1 -0
- package/dist/date-range/date-range.d.ts +43 -0
- package/dist/date-range/date-range.dto-builder.d.ts +8 -0
- package/dist/date-range/date-range.dto-builder.js +21 -0
- package/dist/date-range/date-range.dto-builder.js.map +1 -0
- package/dist/date-range/date-range.dto.d.ts +7 -0
- package/dist/date-range/date-range.dto.js +31 -0
- package/dist/date-range/date-range.dto.js.map +1 -0
- package/dist/date-range/date-range.js +153 -0
- package/dist/date-range/date-range.js.map +1 -0
- package/dist/date-range/date-range.response.d.ts +6 -0
- package/dist/date-range/date-range.response.js +27 -0
- package/dist/date-range/date-range.response.js.map +1 -0
- package/dist/date-range/index.d.ts +7 -0
- package/dist/date-range/index.js +8 -0
- package/dist/date-range/index.js.map +1 -0
- package/dist/date-range/is-date-range.decorator.d.ts +19 -0
- package/dist/date-range/is-date-range.decorator.js +68 -0
- package/dist/date-range/is-date-range.decorator.js.map +1 -0
- package/dist/date-range/tests/date-range.unit.test.d.ts +1 -0
- package/dist/date-range/tests/date-range.unit.test.js +412 -0
- package/dist/date-range/tests/date-range.unit.test.js.map +1 -0
- package/dist/date-range/tests/is-date-range.decorator.unit.test.d.ts +1 -0
- package/dist/date-range/tests/is-date-range.decorator.unit.test.js +120 -0
- package/dist/date-range/tests/is-date-range.decorator.unit.test.js.map +1 -0
- package/dist/date-range/typeorm/contains-plain-date.d.ts +4 -0
- package/dist/date-range/typeorm/contains-plain-date.js +8 -0
- package/dist/date-range/typeorm/contains-plain-date.js.map +1 -0
- package/dist/date-range/typeorm/date-range-column.d.ts +11 -0
- package/dist/date-range/typeorm/date-range-column.js +32 -0
- package/dist/date-range/typeorm/date-range-column.js.map +1 -0
- package/dist/date-range/typeorm/index.d.ts +2 -0
- package/dist/date-range/typeorm/index.js +3 -0
- package/dist/date-range/typeorm/index.js.map +1 -0
- package/dist/date-time-range/date-time-range.command-builder.d.ts +8 -0
- package/dist/date-time-range/date-time-range.command-builder.js +21 -0
- package/dist/date-time-range/date-time-range.command-builder.js.map +1 -0
- package/dist/date-time-range/date-time-range.command.d.ts +7 -0
- package/dist/date-time-range/date-time-range.command.js +30 -0
- package/dist/date-time-range/date-time-range.command.js.map +1 -0
- package/dist/date-time-range/date-time-range.d.ts +93 -0
- package/dist/date-time-range/date-time-range.errors.d.ts +10 -0
- package/dist/date-time-range/date-time-range.errors.js +19 -0
- package/dist/date-time-range/date-time-range.errors.js.map +1 -0
- package/dist/date-time-range/date-time-range.js +205 -0
- package/dist/date-time-range/date-time-range.js.map +1 -0
- package/dist/date-time-range/date-time-range.response.d.ts +6 -0
- package/dist/date-time-range/date-time-range.response.js +27 -0
- package/dist/date-time-range/date-time-range.response.js.map +1 -0
- package/dist/date-time-range/index.d.ts +7 -0
- package/dist/date-time-range/index.js +8 -0
- package/dist/date-time-range/index.js.map +1 -0
- package/dist/date-time-range/is-date-time-range.decorator.d.ts +15 -0
- package/dist/date-time-range/is-date-time-range.decorator.js +58 -0
- package/dist/date-time-range/is-date-time-range.decorator.js.map +1 -0
- package/dist/date-time-range/tests/date-time-range.column.integration.test.d.ts +1 -0
- package/dist/date-time-range/tests/date-time-range.column.integration.test.js +442 -0
- package/dist/date-time-range/tests/date-time-range.column.integration.test.js.map +1 -0
- package/dist/date-time-range/tests/date-time-range.unit.test.d.ts +1 -0
- package/dist/date-time-range/tests/date-time-range.unit.test.js +775 -0
- package/dist/date-time-range/tests/date-time-range.unit.test.js.map +1 -0
- package/dist/date-time-range/tests/is-date-time-range.decorator.unit.test.d.ts +1 -0
- package/dist/date-time-range/tests/is-date-time-range.decorator.unit.test.js +74 -0
- package/dist/date-time-range/tests/is-date-time-range.decorator.unit.test.js.map +1 -0
- package/dist/date-time-range/tests/sql/datasource.d.ts +2 -0
- package/dist/date-time-range/tests/sql/datasource.js +16 -0
- package/dist/date-time-range/tests/sql/datasource.js.map +1 -0
- package/dist/date-time-range/tests/sql/date-time-range-test.entity.d.ts +5 -0
- package/dist/date-time-range/tests/sql/date-time-range-test.entity.js +29 -0
- package/dist/date-time-range/tests/sql/date-time-range-test.entity.js.map +1 -0
- package/dist/date-time-range/tests/sql/multi-date-time-range-test.entity.d.ts +5 -0
- package/dist/date-time-range/tests/sql/multi-date-time-range-test.entity.js +28 -0
- package/dist/date-time-range/tests/sql/multi-date-time-range-test.entity.js.map +1 -0
- package/dist/date-time-range/typeorm/contains-timestamp.d.ts +4 -0
- package/dist/date-time-range/typeorm/contains-timestamp.js +8 -0
- package/dist/date-time-range/typeorm/contains-timestamp.js.map +1 -0
- package/dist/date-time-range/typeorm/date-time-range-column.d.ts +11 -0
- package/dist/date-time-range/typeorm/date-time-range-column.js +32 -0
- package/dist/date-time-range/typeorm/date-time-range-column.js.map +1 -0
- package/dist/date-time-range/typeorm/index.d.ts +3 -0
- package/dist/date-time-range/typeorm/index.js +4 -0
- package/dist/date-time-range/typeorm/index.js.map +1 -0
- package/dist/date-time-range/typeorm/multi-date-time-range.column.d.ts +3 -0
- package/dist/date-time-range/typeorm/multi-date-time-range.column.js +47 -0
- package/dist/date-time-range/typeorm/multi-date-time-range.column.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/multi-date-time-range/multi-date-time-range.d.ts +20 -0
- package/dist/multi-date-time-range/multi-date-time-range.js +51 -0
- package/dist/multi-date-time-range/multi-date-time-range.js.map +1 -0
- package/dist/multi-date-time-range/tests/multi-date-time-range.unit.test.d.ts +1 -0
- package/dist/multi-date-time-range/tests/multi-date-time-range.unit.test.js +129 -0
- package/dist/multi-date-time-range/tests/multi-date-time-range.unit.test.js.map +1 -0
- package/dist/plain-date/api-property/index.d.ts +1 -0
- package/dist/plain-date/api-property/index.js +2 -0
- package/dist/plain-date/api-property/index.js.map +1 -0
- package/dist/plain-date/api-property/plain-date.api-property.d.ts +2 -0
- package/dist/plain-date/api-property/plain-date.api-property.js +12 -0
- package/dist/plain-date/api-property/plain-date.api-property.js.map +1 -0
- package/dist/plain-date/dayjs-plain-date.d.ts +57 -0
- package/dist/plain-date/dayjs-plain-date.js +170 -0
- package/dist/plain-date/dayjs-plain-date.js.map +1 -0
- package/dist/plain-date/future-infinity-date.d.ts +38 -0
- package/dist/plain-date/future-infinity-date.js +100 -0
- package/dist/plain-date/future-infinity-date.js.map +1 -0
- package/dist/plain-date/index.d.ts +8 -0
- package/dist/plain-date/index.js +9 -0
- package/dist/plain-date/index.js.map +1 -0
- package/dist/plain-date/invalid-date.d.ts +5 -0
- package/dist/plain-date/invalid-date.js +8 -0
- package/dist/plain-date/invalid-date.js.map +1 -0
- package/dist/plain-date/max.d.ts +2 -0
- package/dist/plain-date/max.js +15 -0
- package/dist/plain-date/max.js.map +1 -0
- package/dist/plain-date/min.d.ts +2 -0
- package/dist/plain-date/min.js +16 -0
- package/dist/plain-date/min.js.map +1 -0
- package/dist/plain-date/past-infinity-date.d.ts +39 -0
- package/dist/plain-date/past-infinity-date.js +100 -0
- package/dist/plain-date/past-infinity-date.js.map +1 -0
- package/dist/plain-date/plain-date-object.d.ts +6 -0
- package/dist/plain-date/plain-date-object.js +2 -0
- package/dist/plain-date/plain-date-object.js.map +1 -0
- package/dist/plain-date/plain-date.d.ts +44 -0
- package/dist/plain-date/plain-date.factory.d.ts +16 -0
- package/dist/plain-date/plain-date.factory.js +41 -0
- package/dist/plain-date/plain-date.factory.js.map +1 -0
- package/dist/plain-date/plain-date.fn.d.ts +16 -0
- package/dist/plain-date/plain-date.fn.js +14 -0
- package/dist/plain-date/plain-date.fn.js.map +1 -0
- package/dist/plain-date/plain-date.js +2 -0
- package/dist/plain-date/plain-date.js.map +1 -0
- package/dist/plain-date/plain-date.units.d.ts +4 -0
- package/dist/plain-date/plain-date.units.js +2 -0
- package/dist/plain-date/plain-date.units.js.map +1 -0
- package/dist/plain-date/tests/plain-date.accessors.unit.test.d.ts +1 -0
- package/dist/plain-date/tests/plain-date.accessors.unit.test.js +22 -0
- package/dist/plain-date/tests/plain-date.accessors.unit.test.js.map +1 -0
- package/dist/plain-date/tests/plain-date.constructor.unit.test.d.ts +1 -0
- package/dist/plain-date/tests/plain-date.constructor.unit.test.js +40 -0
- package/dist/plain-date/tests/plain-date.constructor.unit.test.js.map +1 -0
- package/dist/plain-date/tests/plain-date.factory.unit.test.d.ts +1 -0
- package/dist/plain-date/tests/plain-date.factory.unit.test.js +136 -0
- package/dist/plain-date/tests/plain-date.factory.unit.test.js.map +1 -0
- package/dist/plain-date/tests/plain-date.manipulation.unit.test.d.ts +1 -0
- package/dist/plain-date/tests/plain-date.manipulation.unit.test.js +93 -0
- package/dist/plain-date/tests/plain-date.manipulation.unit.test.js.map +1 -0
- package/dist/plain-date/tests/wise-date.ordering.unit.test.d.ts +1 -0
- package/dist/plain-date/tests/wise-date.ordering.unit.test.js +174 -0
- package/dist/plain-date/tests/wise-date.ordering.unit.test.js.map +1 -0
- package/dist/plain-date/typeorm/index.d.ts +1 -0
- package/dist/plain-date/typeorm/index.js +2 -0
- package/dist/plain-date/typeorm/index.js.map +1 -0
- package/dist/plain-date/typeorm/plain-date.column.d.ts +3 -0
- package/dist/plain-date/typeorm/plain-date.column.js +24 -0
- package/dist/plain-date/typeorm/plain-date.column.js.map +1 -0
- package/dist/plain-date/validators/index.d.ts +1 -0
- package/dist/plain-date/validators/index.js +2 -0
- package/dist/plain-date/validators/index.js.map +1 -0
- package/dist/plain-date/validators/is-plain-date.validator.d.ts +7 -0
- package/dist/plain-date/validators/is-plain-date.validator.js +34 -0
- package/dist/plain-date/validators/is-plain-date.validator.js.map +1 -0
- package/dist/plain-time/api-property/index.d.ts +1 -0
- package/dist/plain-time/api-property/index.js +2 -0
- package/dist/plain-time/api-property/index.js.map +1 -0
- package/dist/plain-time/api-property/plain-time.api-property.d.ts +2 -0
- package/dist/plain-time/api-property/plain-time.api-property.js +5 -0
- package/dist/plain-time/api-property/plain-time.api-property.js.map +1 -0
- package/dist/plain-time/constants.d.ts +4 -0
- package/dist/plain-time/constants.js +5 -0
- package/dist/plain-time/constants.js.map +1 -0
- package/dist/plain-time/index.d.ts +8 -0
- package/dist/plain-time/index.js +8 -0
- package/dist/plain-time/index.js.map +1 -0
- package/dist/plain-time/is-valid-time-string.d.ts +2 -0
- package/dist/plain-time/is-valid-time-string.js +5 -0
- package/dist/plain-time/is-valid-time-string.js.map +1 -0
- package/dist/plain-time/max.d.ts +2 -0
- package/dist/plain-time/max.js +15 -0
- package/dist/plain-time/max.js.map +1 -0
- package/dist/plain-time/min.d.ts +2 -0
- package/dist/plain-time/min.js +15 -0
- package/dist/plain-time/min.js.map +1 -0
- package/dist/plain-time/plain-time-entry.d.ts +18 -0
- package/dist/plain-time/plain-time-entry.js +11 -0
- package/dist/plain-time/plain-time-entry.js.map +1 -0
- package/dist/plain-time/plain-time-error.d.ts +12 -0
- package/dist/plain-time/plain-time-error.js +19 -0
- package/dist/plain-time/plain-time-error.js.map +1 -0
- package/dist/plain-time/plain-time-object.type.d.ts +6 -0
- package/dist/plain-time/plain-time-object.type.js +2 -0
- package/dist/plain-time/plain-time-object.type.js.map +1 -0
- package/dist/plain-time/plain-time.d.ts +44 -0
- package/dist/plain-time/plain-time.factory.d.ts +12 -0
- package/dist/plain-time/plain-time.factory.js +10 -0
- package/dist/plain-time/plain-time.factory.js.map +1 -0
- package/dist/plain-time/plain-time.js +160 -0
- package/dist/plain-time/plain-time.js.map +1 -0
- package/dist/plain-time/seconds-in-unit.d.ts +11 -0
- package/dist/plain-time/seconds-in-unit.js +13 -0
- package/dist/plain-time/seconds-in-unit.js.map +1 -0
- package/dist/plain-time/tests/is-plain-time-after.validator.test.d.ts +1 -0
- package/dist/plain-time/tests/is-plain-time-after.validator.test.js +49 -0
- package/dist/plain-time/tests/is-plain-time-after.validator.test.js.map +1 -0
- package/dist/plain-time/tests/is-plain-time.validator.test.d.ts +1 -0
- package/dist/plain-time/tests/is-plain-time.validator.test.js +45 -0
- package/dist/plain-time/tests/is-plain-time.validator.test.js.map +1 -0
- package/dist/plain-time/tests/plain-time.unit.test.d.ts +1 -0
- package/dist/plain-time/tests/plain-time.unit.test.js +323 -0
- package/dist/plain-time/tests/plain-time.unit.test.js.map +1 -0
- package/dist/plain-time/time-unit.d.ts +1 -0
- package/dist/plain-time/time-unit.js +2 -0
- package/dist/plain-time/time-unit.js.map +1 -0
- package/dist/plain-time/typeorm/index.d.ts +1 -0
- package/dist/plain-time/typeorm/index.js +2 -0
- package/dist/plain-time/typeorm/index.js.map +1 -0
- package/dist/plain-time/typeorm/plain-time-column.d.ts +3 -0
- package/dist/plain-time/typeorm/plain-time-column.js +26 -0
- package/dist/plain-time/typeorm/plain-time-column.js.map +1 -0
- package/dist/plain-time/validators/index.d.ts +6 -0
- package/dist/plain-time/validators/index.js +7 -0
- package/dist/plain-time/validators/index.js.map +1 -0
- package/dist/plain-time/validators/is-plain-time-after.validator.d.ts +5 -0
- package/dist/plain-time/validators/is-plain-time-after.validator.js +47 -0
- package/dist/plain-time/validators/is-plain-time-after.validator.js.map +1 -0
- package/dist/plain-time/validators/is-plain-time-before.validator.d.ts +5 -0
- package/dist/plain-time/validators/is-plain-time-before.validator.js +47 -0
- package/dist/plain-time/validators/is-plain-time-before.validator.js.map +1 -0
- package/dist/plain-time/validators/is-plain-time-between.validator.d.ts +6 -0
- package/dist/plain-time/validators/is-plain-time-between.validator.js +52 -0
- package/dist/plain-time/validators/is-plain-time-between.validator.js.map +1 -0
- package/dist/plain-time/validators/is-plain-time-same-or-after.validator.d.ts +5 -0
- package/dist/plain-time/validators/is-plain-time-same-or-after.validator.js +47 -0
- package/dist/plain-time/validators/is-plain-time-same-or-after.validator.js.map +1 -0
- package/dist/plain-time/validators/is-plain-time-same-or-before.validator.d.ts +5 -0
- package/dist/plain-time/validators/is-plain-time-same-or-before.validator.js +47 -0
- package/dist/plain-time/validators/is-plain-time-same-or-before.validator.js.map +1 -0
- package/dist/plain-time/validators/is-plain-time.validator.d.ts +3 -0
- package/dist/plain-time/validators/is-plain-time.validator.js +7 -0
- package/dist/plain-time/validators/is-plain-time.validator.js.map +1 -0
- package/dist/rrule/frequency.d.ts +12 -0
- package/dist/rrule/frequency.js +25 -0
- package/dist/rrule/frequency.js.map +1 -0
- package/dist/rrule/index.d.ts +16 -0
- package/dist/rrule/index.js +7 -0
- package/dist/rrule/index.js.map +1 -0
- package/dist/rrule/rrule.d.ts +23 -0
- package/dist/rrule/rrule.factory.d.ts +20 -0
- package/dist/rrule/rrule.factory.js +8 -0
- package/dist/rrule/rrule.factory.js.map +1 -0
- package/dist/rrule/rrule.js +114 -0
- package/dist/rrule/rrule.js.map +1 -0
- package/dist/rrule/rrule.once.d.ts +14 -0
- package/dist/rrule/rrule.once.js +19 -0
- package/dist/rrule/rrule.once.js.map +1 -0
- package/dist/rrule/tests/rrule.once.unit.test.d.ts +1 -0
- package/dist/rrule/tests/rrule.once.unit.test.js +19 -0
- package/dist/rrule/tests/rrule.once.unit.test.js.map +1 -0
- package/dist/rrule/tests/rrule.unit.test.d.ts +1 -0
- package/dist/rrule/tests/rrule.unit.test.js +202 -0
- package/dist/rrule/tests/rrule.unit.test.js.map +1 -0
- package/dist/rrule/typeorm/index.d.ts +1 -0
- package/dist/rrule/typeorm/index.js +2 -0
- package/dist/rrule/typeorm/index.js.map +1 -0
- package/dist/rrule/typeorm/rrule-column.d.ts +2 -0
- package/dist/rrule/typeorm/rrule-column.js +6 -0
- package/dist/rrule/typeorm/rrule-column.js.map +1 -0
- package/dist/timestamp/api-property/index.d.ts +1 -0
- package/dist/timestamp/api-property/index.js +2 -0
- package/dist/timestamp/api-property/index.js.map +1 -0
- package/dist/timestamp/api-property/timestamp.api-property.d.ts +2 -0
- package/dist/timestamp/api-property/timestamp.api-property.js +12 -0
- package/dist/timestamp/api-property/timestamp.api-property.js.map +1 -0
- package/dist/timestamp/dayjs-timestamp.d.ts +59 -0
- package/dist/timestamp/dayjs-timestamp.js +205 -0
- package/dist/timestamp/dayjs-timestamp.js.map +1 -0
- package/dist/timestamp/future-infinity.d.ts +48 -0
- package/dist/timestamp/future-infinity.js +128 -0
- package/dist/timestamp/future-infinity.js.map +1 -0
- package/dist/timestamp/index.d.ts +30 -0
- package/dist/timestamp/index.js +15 -0
- package/dist/timestamp/index.js.map +1 -0
- package/dist/timestamp/max.d.ts +2 -0
- package/dist/timestamp/max.js +15 -0
- package/dist/timestamp/max.js.map +1 -0
- package/dist/timestamp/min.d.ts +2 -0
- package/dist/timestamp/min.js +15 -0
- package/dist/timestamp/min.js.map +1 -0
- package/dist/timestamp/past-infinity.d.ts +48 -0
- package/dist/timestamp/past-infinity.js +128 -0
- package/dist/timestamp/past-infinity.js.map +1 -0
- package/dist/timestamp/tests/dayjs-timestamp.unit.test.d.ts +1 -0
- package/dist/timestamp/tests/dayjs-timestamp.unit.test.js +18 -0
- package/dist/timestamp/tests/dayjs-timestamp.unit.test.js.map +1 -0
- package/dist/timestamp/tests/timestamp.factory.unit.test.d.ts +1 -0
- package/dist/timestamp/tests/timestamp.factory.unit.test.js +16 -0
- package/dist/timestamp/tests/timestamp.factory.unit.test.js.map +1 -0
- package/dist/timestamp/timestamp.d.ts +83 -0
- package/dist/timestamp/timestamp.factory.d.ts +18 -0
- package/dist/timestamp/timestamp.factory.js +36 -0
- package/dist/timestamp/timestamp.factory.js.map +1 -0
- package/dist/timestamp/timestamp.js +2 -0
- package/dist/timestamp/timestamp.js.map +1 -0
- package/dist/timestamp/typeorm/index.d.ts +1 -0
- package/dist/timestamp/typeorm/index.js +2 -0
- package/dist/timestamp/typeorm/index.js.map +1 -0
- package/dist/timestamp/typeorm/timestamp.column.d.ts +3 -0
- package/dist/timestamp/typeorm/timestamp.column.js +25 -0
- package/dist/timestamp/typeorm/timestamp.column.js.map +1 -0
- package/dist/timestamp/validators/index.d.ts +1 -0
- package/dist/timestamp/validators/index.js +2 -0
- package/dist/timestamp/validators/index.js.map +1 -0
- package/dist/timestamp/validators/is-timestamp.validator.d.ts +7 -0
- package/dist/timestamp/validators/is-timestamp.validator.js +34 -0
- package/dist/timestamp/validators/is-timestamp.validator.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { plainDate } from '../plain-date/index.js';
|
|
2
|
+
import { plainTime } from '../plain-time/plain-time-entry.js';
|
|
3
|
+
import { factory } from './timestamp.factory.js';
|
|
4
|
+
export class FutureInfinity {
|
|
5
|
+
clone() {
|
|
6
|
+
return this;
|
|
7
|
+
}
|
|
8
|
+
isPastInfinity() {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
isFutureInfinity() {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
isInfinity() {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
isValid() {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
year() {
|
|
21
|
+
throw new Error('cannot access year on future infinity');
|
|
22
|
+
}
|
|
23
|
+
month() {
|
|
24
|
+
throw new Error('cannot access month on future infinity');
|
|
25
|
+
}
|
|
26
|
+
date() {
|
|
27
|
+
throw new Error('cannot access date on future infinity');
|
|
28
|
+
}
|
|
29
|
+
day() {
|
|
30
|
+
throw new Error('cannot access day on future infinity');
|
|
31
|
+
}
|
|
32
|
+
hour() {
|
|
33
|
+
throw new Error('cannot access hour on future infinity');
|
|
34
|
+
}
|
|
35
|
+
minute() {
|
|
36
|
+
throw new Error('cannot access minute on future infinity');
|
|
37
|
+
}
|
|
38
|
+
second() {
|
|
39
|
+
throw new Error('cannot access second on future infinity');
|
|
40
|
+
}
|
|
41
|
+
millisecond() {
|
|
42
|
+
throw new Error('cannot access millisecond on future infinity');
|
|
43
|
+
}
|
|
44
|
+
set() {
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
get(unit) {
|
|
48
|
+
throw new Error(`cannot access ${unit} on future infinity`);
|
|
49
|
+
}
|
|
50
|
+
add() {
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
addDuration() {
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
subtract() {
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
startOf() {
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
endOf() {
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
format() {
|
|
66
|
+
return 'infinity';
|
|
67
|
+
}
|
|
68
|
+
diff() {
|
|
69
|
+
return Infinity;
|
|
70
|
+
}
|
|
71
|
+
valueOf() {
|
|
72
|
+
return Infinity;
|
|
73
|
+
}
|
|
74
|
+
unix() {
|
|
75
|
+
return Infinity;
|
|
76
|
+
}
|
|
77
|
+
daysInMonth() {
|
|
78
|
+
throw new Error(`cannot access days in month on future infinity`);
|
|
79
|
+
}
|
|
80
|
+
toDate() {
|
|
81
|
+
throw new Error(`cannot convert future infinity to Date`);
|
|
82
|
+
}
|
|
83
|
+
toJSON() {
|
|
84
|
+
return '"infinity"';
|
|
85
|
+
}
|
|
86
|
+
toISOString() {
|
|
87
|
+
return 'infinity';
|
|
88
|
+
}
|
|
89
|
+
toString() {
|
|
90
|
+
return 'infinity';
|
|
91
|
+
}
|
|
92
|
+
toPlainDate() {
|
|
93
|
+
return plainDate(this);
|
|
94
|
+
}
|
|
95
|
+
toPlainTime() {
|
|
96
|
+
return plainTime({ hours: 24, minutes: 0, seconds: 0, milliseconds: 0 });
|
|
97
|
+
}
|
|
98
|
+
utcOffset() {
|
|
99
|
+
return Infinity;
|
|
100
|
+
}
|
|
101
|
+
isBefore() {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
isAfter(other) {
|
|
105
|
+
other = factory(other);
|
|
106
|
+
return !other.isFutureInfinity();
|
|
107
|
+
}
|
|
108
|
+
isSame(other) {
|
|
109
|
+
other = factory(other);
|
|
110
|
+
return other instanceof FutureInfinity;
|
|
111
|
+
}
|
|
112
|
+
isSameOrAfter(other) {
|
|
113
|
+
return this.isAfter(other) || this.isSame(other);
|
|
114
|
+
}
|
|
115
|
+
isSameOrBefore(other) {
|
|
116
|
+
return this.isSame(other);
|
|
117
|
+
}
|
|
118
|
+
locale(preset, _object) {
|
|
119
|
+
if (preset === undefined) {
|
|
120
|
+
return 'infinity';
|
|
121
|
+
}
|
|
122
|
+
return this;
|
|
123
|
+
}
|
|
124
|
+
setTimezone(_timezone) {
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=future-infinity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"future-infinity.js","sourceRoot":"","sources":["../../lib/timestamp/future-infinity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAA;AAI7D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAEhD,MAAM,OAAO,cAAc;IACzB,KAAK;QACH,OAAO,IAAI,CAAA;IACb,CAA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AI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,OAAO,UAAU,CAAA;QACnB,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,WAAW,CAAE,SAAwB;QACnC,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Dayjs } from 'dayjs';
|
|
2
|
+
import { TimezoneInput } from '../common/timezone.js';
|
|
3
|
+
import { PlainDate } from '../plain-date/plain-date.js';
|
|
4
|
+
import { PlainTime } from '../plain-time/plain-time.js';
|
|
5
|
+
import { Timestamp, TimestampInput } from './timestamp.js';
|
|
6
|
+
export * from './typeorm/index.js';
|
|
7
|
+
export * from './api-property/index.js';
|
|
8
|
+
export * from './timestamp.js';
|
|
9
|
+
export * from './validators/index.js';
|
|
10
|
+
export interface TimestampFn {
|
|
11
|
+
(): Timestamp;
|
|
12
|
+
(date: undefined): Timestamp;
|
|
13
|
+
(date: null): null;
|
|
14
|
+
(date: string): Timestamp;
|
|
15
|
+
(date: number): Timestamp;
|
|
16
|
+
(date: Date): Timestamp;
|
|
17
|
+
(date: Timestamp): Timestamp;
|
|
18
|
+
(date: Dayjs): Timestamp;
|
|
19
|
+
(date?: number | Date | string | null): Timestamp | null;
|
|
20
|
+
(date?: Timestamp | null): Timestamp | null;
|
|
21
|
+
(date?: number | Date | string | null): Timestamp | null;
|
|
22
|
+
(date: TimestampInput): Timestamp;
|
|
23
|
+
(date?: TimestampInput | null): Timestamp | null;
|
|
24
|
+
(date: PlainDate, time: PlainTime, tz?: TimezoneInput): Timestamp;
|
|
25
|
+
futureInfinity(): Timestamp;
|
|
26
|
+
pastInfinity(): Timestamp;
|
|
27
|
+
max(...times: TimestampInput[]): Timestamp;
|
|
28
|
+
min(...times: TimestampInput[]): Timestamp;
|
|
29
|
+
}
|
|
30
|
+
export declare const timestamp: TimestampFn;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { max } from './max.js';
|
|
2
|
+
import { min } from './min.js';
|
|
3
|
+
import { factory } from './timestamp.factory.js';
|
|
4
|
+
import { FutureInfinity } from './future-infinity.js';
|
|
5
|
+
import { PastInfinity } from './past-infinity.js';
|
|
6
|
+
export * from './typeorm/index.js';
|
|
7
|
+
export * from './api-property/index.js';
|
|
8
|
+
export * from './timestamp.js';
|
|
9
|
+
export * from './validators/index.js';
|
|
10
|
+
export const timestamp = factory;
|
|
11
|
+
timestamp.futureInfinity = () => new FutureInfinity();
|
|
12
|
+
timestamp.pastInfinity = () => new PastInfinity();
|
|
13
|
+
timestamp.max = max;
|
|
14
|
+
timestamp.min = min;
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/timestamp/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AAwBrC,MAAM,CAAC,MAAM,SAAS,GAAG,OAAiC,CAAA;AAE1D,SAAS,CAAC,cAAc,GAAG,GAAG,EAAE,CAAC,IAAI,cAAc,EAAE,CAAA;AACrD,SAAS,CAAC,YAAY,GAAG,GAAG,EAAE,CAAC,IAAI,YAAY,EAAE,CAAA;AACjD,SAAS,CAAC,GAAG,GAAG,GAAG,CAAA;AACnB,SAAS,CAAC,GAAG,GAAG,GAAG,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { timestamp } from './index.js';
|
|
2
|
+
export function max(...timestamps) {
|
|
3
|
+
if (timestamps.length === 0) {
|
|
4
|
+
throw new Error('Invalid arguments, no dates provided to compare');
|
|
5
|
+
}
|
|
6
|
+
const stamps = timestamps.map(t => timestamp(t));
|
|
7
|
+
let max = timestamp(stamps[0]);
|
|
8
|
+
for (let i = 1; i < stamps.length; i++) {
|
|
9
|
+
if (stamps[i].isAfter(max)) {
|
|
10
|
+
max = stamps[i];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return max;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=max.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"max.js","sourceRoot":"","sources":["../../lib/timestamp/max.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC,MAAM,UAAU,GAAG,CAAE,GAAG,UAA4B;IAClD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAA;IACpE,CAAC;IAED,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IAEhD,IAAI,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAE9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { timestamp } from './index.js';
|
|
2
|
+
export function min(...timestamps) {
|
|
3
|
+
if (timestamps.length === 0) {
|
|
4
|
+
throw new Error('Invalid arguments, no dates provided to compare');
|
|
5
|
+
}
|
|
6
|
+
const stamps = timestamps.map(t => timestamp(t));
|
|
7
|
+
let min = timestamp(stamps[0]);
|
|
8
|
+
for (let i = 1; i < stamps.length; i++) {
|
|
9
|
+
if (stamps[i].isBefore(min)) {
|
|
10
|
+
min = stamps[i];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return min;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"min.js","sourceRoot":"","sources":["../../lib/timestamp/min.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC,MAAM,UAAU,GAAG,CAAE,GAAG,UAA4B;IAClD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAA;IACpE,CAAC;IAED,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IAEhD,IAAI,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAE9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5B,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { OpUnitType } from 'dayjs';
|
|
2
|
+
import { PlainDate } from '../plain-date/plain-date.js';
|
|
3
|
+
import { PlainTime } from '../plain-time/plain-time.js';
|
|
4
|
+
import { Month } from '../common/month.js';
|
|
5
|
+
import { TimezoneInput } from '../common/timezone.js';
|
|
6
|
+
import { ILocale, Timestamp, TimestampInput } from './timestamp.js';
|
|
7
|
+
export declare class PastInfinity implements Timestamp {
|
|
8
|
+
clone(): this;
|
|
9
|
+
isPastInfinity(): boolean;
|
|
10
|
+
isFutureInfinity(): boolean;
|
|
11
|
+
isInfinity(): boolean;
|
|
12
|
+
isValid(): boolean;
|
|
13
|
+
year(): number | Timestamp;
|
|
14
|
+
month(): Month | Timestamp;
|
|
15
|
+
date(): number | Timestamp;
|
|
16
|
+
day(): number | Timestamp;
|
|
17
|
+
hour(): number | Timestamp;
|
|
18
|
+
minute(): number | Timestamp;
|
|
19
|
+
second(): number | Timestamp;
|
|
20
|
+
millisecond(): number | Timestamp;
|
|
21
|
+
set(): this;
|
|
22
|
+
get(unit: OpUnitType): number;
|
|
23
|
+
add(): this;
|
|
24
|
+
addDuration(): this;
|
|
25
|
+
subtract(): this;
|
|
26
|
+
startOf(): this;
|
|
27
|
+
endOf(): this;
|
|
28
|
+
format(): '-infinity';
|
|
29
|
+
diff(): number;
|
|
30
|
+
valueOf(): number;
|
|
31
|
+
unix(): number;
|
|
32
|
+
daysInMonth(): number;
|
|
33
|
+
toDate(): Date;
|
|
34
|
+
toJSON(): '"-infinity"';
|
|
35
|
+
toISOString(): '-infinity';
|
|
36
|
+
toString(): '-infinity';
|
|
37
|
+
toPlainDate(): PlainDate;
|
|
38
|
+
toPlainTime(): PlainTime;
|
|
39
|
+
utcOffset(): number;
|
|
40
|
+
isBefore(other: TimestampInput): boolean;
|
|
41
|
+
isAfter(): boolean;
|
|
42
|
+
isSame(other: TimestampInput): boolean;
|
|
43
|
+
isSameOrAfter(other: TimestampInput): boolean;
|
|
44
|
+
isSameOrBefore(other: TimestampInput): boolean;
|
|
45
|
+
locale(): string;
|
|
46
|
+
locale(preset: string | ILocale, object?: Partial<ILocale>): this;
|
|
47
|
+
setTimezone(_timezone: TimezoneInput): Timestamp;
|
|
48
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { plainDate } from '../plain-date/index.js';
|
|
2
|
+
import { plainTime } from '../plain-time/plain-time-entry.js';
|
|
3
|
+
import { factory } from './timestamp.factory.js';
|
|
4
|
+
export class PastInfinity {
|
|
5
|
+
clone() {
|
|
6
|
+
return this;
|
|
7
|
+
}
|
|
8
|
+
isPastInfinity() {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
isFutureInfinity() {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
isInfinity() {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
isValid() {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
year() {
|
|
21
|
+
throw new Error('cannot access year on past infinity');
|
|
22
|
+
}
|
|
23
|
+
month() {
|
|
24
|
+
throw new Error('cannot access month on past infinity');
|
|
25
|
+
}
|
|
26
|
+
date() {
|
|
27
|
+
throw new Error('cannot access date on past infinity');
|
|
28
|
+
}
|
|
29
|
+
day() {
|
|
30
|
+
throw new Error('cannot access day on past infinity');
|
|
31
|
+
}
|
|
32
|
+
hour() {
|
|
33
|
+
throw new Error('cannot access hour on past infinity');
|
|
34
|
+
}
|
|
35
|
+
minute() {
|
|
36
|
+
throw new Error('cannot access minute on past infinity');
|
|
37
|
+
}
|
|
38
|
+
second() {
|
|
39
|
+
throw new Error('cannot access second on past infinity');
|
|
40
|
+
}
|
|
41
|
+
millisecond() {
|
|
42
|
+
throw new Error('cannot access millisecond on past infinity');
|
|
43
|
+
}
|
|
44
|
+
set() {
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
get(unit) {
|
|
48
|
+
throw new Error(`cannot access ${unit} on past infinity`);
|
|
49
|
+
}
|
|
50
|
+
add() {
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
addDuration() {
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
subtract() {
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
startOf() {
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
endOf() {
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
format() {
|
|
66
|
+
return '-infinity';
|
|
67
|
+
}
|
|
68
|
+
diff() {
|
|
69
|
+
return -Infinity;
|
|
70
|
+
}
|
|
71
|
+
valueOf() {
|
|
72
|
+
return -Infinity;
|
|
73
|
+
}
|
|
74
|
+
unix() {
|
|
75
|
+
return -Infinity;
|
|
76
|
+
}
|
|
77
|
+
daysInMonth() {
|
|
78
|
+
throw new Error(`cannot access days in month on past infinity`);
|
|
79
|
+
}
|
|
80
|
+
toDate() {
|
|
81
|
+
throw new Error(`cannot convert past infinity to Date`);
|
|
82
|
+
}
|
|
83
|
+
toJSON() {
|
|
84
|
+
return '"-infinity"';
|
|
85
|
+
}
|
|
86
|
+
toISOString() {
|
|
87
|
+
return '-infinity';
|
|
88
|
+
}
|
|
89
|
+
toString() {
|
|
90
|
+
return '-infinity';
|
|
91
|
+
}
|
|
92
|
+
toPlainDate() {
|
|
93
|
+
return plainDate(this);
|
|
94
|
+
}
|
|
95
|
+
toPlainTime() {
|
|
96
|
+
return plainTime(0);
|
|
97
|
+
}
|
|
98
|
+
utcOffset() {
|
|
99
|
+
return -Infinity;
|
|
100
|
+
}
|
|
101
|
+
isBefore(other) {
|
|
102
|
+
other = factory(other);
|
|
103
|
+
return !other.isPastInfinity();
|
|
104
|
+
}
|
|
105
|
+
isAfter() {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
isSame(other) {
|
|
109
|
+
other = factory(other);
|
|
110
|
+
return other instanceof PastInfinity;
|
|
111
|
+
}
|
|
112
|
+
isSameOrAfter(other) {
|
|
113
|
+
return this.isSame(other);
|
|
114
|
+
}
|
|
115
|
+
isSameOrBefore(other) {
|
|
116
|
+
return this.isBefore(other) || this.isSame(other);
|
|
117
|
+
}
|
|
118
|
+
locale(preset, _object) {
|
|
119
|
+
if (preset === undefined) {
|
|
120
|
+
return '-infinity';
|
|
121
|
+
}
|
|
122
|
+
return this;
|
|
123
|
+
}
|
|
124
|
+
setTimezone(_timezone) {
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=past-infinity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"past-infinity.js","sourceRoot":"","sources":["../../lib/timestamp/past-infinity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAA;AAI7D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAEhD,MAAM,OAAO,YAAY;IACvB,KAAK;QACH,OAAO,IAAI,CAAA;IACb,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAA;IACb,CAAC;IAED,gBAAgB;QACd,OAAO,KAAK,CAAA;IACd,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI;QACF,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;IACxD,CAAC;IAED,KAAK;QACH,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;IACzD,CAAC;IAED,IAAI;QACF,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;IACxD,CAAC;IAED,GAAG;QACD,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;IACvD,CAAC;IAED,IAAI;QACF,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;IACxD,CAAC;IAED,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;IAC1D,CAAC;IAED,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CA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CAAC,cAAc,EAAE,CAAA;IAChC,CAAC;IAED,OAAO;QACL,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,CAAE,KAAqB;QAC3B,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;QAEtB,OAAO,KAAK,YAAY,YAAY,CAAA;IACtC,CAAC;IAED,aAAa,CAAE,KAAqB;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAC3B,CAAC;IAED,cAAc,CAAE,KAAqB;QACnC,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACnD,CAAC;IAID,MAAM,CAAE,MAAyB,EAAE,OAA0B;QAC3D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,OAAO,WAAW,CAAA;QACpB,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,WAAW,CAAE,SAAwB;QACnC,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { describe, before, it } from 'node:test';
|
|
2
|
+
import { expect } from 'expect';
|
|
3
|
+
import { initDayjs } from '../../common/init-dayjs.js';
|
|
4
|
+
import { timestamp } from '../index.js';
|
|
5
|
+
import { plainDate } from '../../plain-date/index.js';
|
|
6
|
+
import { plainTime } from '../../plain-time/plain-time-entry.js';
|
|
7
|
+
describe('DayjsTimestamp', () => {
|
|
8
|
+
before(() => initDayjs());
|
|
9
|
+
it('sets the timezone on a new timestamp', () => {
|
|
10
|
+
const brusselsTs = timestamp(plainDate('2025-12-10'), plainTime('12:00:00'), 'Europe/Brussels');
|
|
11
|
+
const utcTs = brusselsTs.setTimezone('UTC');
|
|
12
|
+
expect(brusselsTs.toISOString()).toBe('2025-12-10T11:00:00.000Z');
|
|
13
|
+
expect(utcTs.toISOString()).toBe('2025-12-10T11:00:00.000Z');
|
|
14
|
+
expect(brusselsTs.format()).toBe('2025-12-10T12:00:00+01:00');
|
|
15
|
+
expect(utcTs.format()).toBe('2025-12-10T11:00:00Z');
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=dayjs-timestamp.unit.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dayjs-timestamp.unit.test.js","sourceRoot":"","sources":["../../../lib/timestamp/tests/dayjs-timestamp.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAEhE,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,MAAM,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAA;IAEzB,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,UAAU,GAAG,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,iBAAiB,CAAC,CAAA;QAC/F,MAAM,KAAK,GAAG,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;QAE3C,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAA;QACjE,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAA;QAE5D,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAA;QAC7D,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAA;IACrD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { before, describe, it } from 'node:test';
|
|
2
|
+
import { expect } from 'expect';
|
|
3
|
+
import { initDayjs } from '../../common/init-dayjs.js';
|
|
4
|
+
import { plainDate } from '../../plain-date/index.js';
|
|
5
|
+
import { plainTime } from '../../plain-time/plain-time-entry.js';
|
|
6
|
+
import { timestamp } from '../index.js';
|
|
7
|
+
describe('Timestamp factory', () => {
|
|
8
|
+
before(() => initDayjs());
|
|
9
|
+
it('Creates a timestamp from a plain date, plain time and timezone', () => {
|
|
10
|
+
const date = plainDate('2025-11-23');
|
|
11
|
+
const time = plainTime('14:33:12');
|
|
12
|
+
const ts = timestamp(date, time, 'Europe/Brussels');
|
|
13
|
+
expect(ts.toISOString()).toBe('2025-11-23T13:33:12.000Z');
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=timestamp.factory.unit.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timestamp.factory.unit.test.js","sourceRoot":"","sources":["../../../lib/timestamp/tests/timestamp.factory.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,MAAM,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAA;IAEzB,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;QACxE,MAAM,IAAI,GAAG,SAAS,CAAC,YAAY,CAAC,CAAA;QACpC,MAAM,IAAI,GAAG,SAAS,CAAC,UAAU,CAAC,CAAA;QAClC,MAAM,EAAE,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAA;QAEnD,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAA;IAC3D,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { UnitType, ManipulateType, OpUnitType, Dayjs } from 'dayjs';
|
|
2
|
+
import { Duration } from '@wisemen/quantity';
|
|
3
|
+
import { PlainDate } from '../plain-date/plain-date.js';
|
|
4
|
+
import { PlainTime } from '../plain-time/plain-time.js';
|
|
5
|
+
import { Month } from '../common/month.js';
|
|
6
|
+
import { TimezoneInput } from '../common/timezone.js';
|
|
7
|
+
export interface ILocale {
|
|
8
|
+
name: string;
|
|
9
|
+
weekdays?: string[];
|
|
10
|
+
months?: string[];
|
|
11
|
+
weekStart?: number;
|
|
12
|
+
weekdaysShort?: string[];
|
|
13
|
+
monthsShort?: string[];
|
|
14
|
+
weekdaysMin?: string[];
|
|
15
|
+
ordinal?: (n: number) => number | string;
|
|
16
|
+
formats: Partial<{
|
|
17
|
+
LT: string;
|
|
18
|
+
LTS: string;
|
|
19
|
+
L: string;
|
|
20
|
+
LL: string;
|
|
21
|
+
LLL: string;
|
|
22
|
+
LLLL: string;
|
|
23
|
+
}>;
|
|
24
|
+
relativeTime: Partial<{
|
|
25
|
+
future: string;
|
|
26
|
+
past: string;
|
|
27
|
+
s: string;
|
|
28
|
+
m: string;
|
|
29
|
+
mm: string;
|
|
30
|
+
h: string;
|
|
31
|
+
hh: string;
|
|
32
|
+
d: string;
|
|
33
|
+
dd: string;
|
|
34
|
+
M: string;
|
|
35
|
+
MM: string;
|
|
36
|
+
y: string;
|
|
37
|
+
yy: string;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
export type TimestampInput = Timestamp | string | Date | null | undefined | number | PlainDate | Dayjs;
|
|
41
|
+
export interface Timestamp {
|
|
42
|
+
clone(): Timestamp;
|
|
43
|
+
isPastInfinity(): boolean;
|
|
44
|
+
isFutureInfinity(): boolean;
|
|
45
|
+
isInfinity(): boolean;
|
|
46
|
+
isValid(): boolean;
|
|
47
|
+
year(value?: number): number | Timestamp;
|
|
48
|
+
month(value?: Month): Month | Timestamp;
|
|
49
|
+
date(value?: number): number | Timestamp;
|
|
50
|
+
day(value?: number): number | Timestamp;
|
|
51
|
+
hour(value?: number): number | Timestamp;
|
|
52
|
+
minute(value?: number): number | Timestamp;
|
|
53
|
+
second(value?: number): number | Timestamp;
|
|
54
|
+
millisecond(value?: number): number | Timestamp;
|
|
55
|
+
set(unit: UnitType, value: number): Timestamp;
|
|
56
|
+
get(unit: UnitType): number;
|
|
57
|
+
add(value: number, unit?: ManipulateType): Timestamp;
|
|
58
|
+
addDuration(duration: Duration): Timestamp;
|
|
59
|
+
subtract(value: number, unit?: ManipulateType): Timestamp;
|
|
60
|
+
startOf(unit: OpUnitType): Timestamp;
|
|
61
|
+
endOf(unit: OpUnitType): Timestamp;
|
|
62
|
+
format(template?: string): string;
|
|
63
|
+
diff(withOther: TimestampInput, unit: OpUnitType): number;
|
|
64
|
+
valueOf(): number;
|
|
65
|
+
unix(): number;
|
|
66
|
+
daysInMonth(): number;
|
|
67
|
+
toDate(): Date;
|
|
68
|
+
toJSON(): string;
|
|
69
|
+
toISOString(): string;
|
|
70
|
+
toString(): string;
|
|
71
|
+
utcOffset(): number;
|
|
72
|
+
isBefore(other: TimestampInput, unit?: OpUnitType): boolean;
|
|
73
|
+
isAfter(other: TimestampInput, unit?: OpUnitType): boolean;
|
|
74
|
+
isSame(other: TimestampInput, unit?: OpUnitType): boolean;
|
|
75
|
+
isSameOrAfter(other: TimestampInput, unit?: OpUnitType): boolean;
|
|
76
|
+
isSameOrBefore(other: TimestampInput, unit?: OpUnitType): boolean;
|
|
77
|
+
locale(preset?: string | ILocale, object?: Partial<ILocale>): Timestamp | string;
|
|
78
|
+
/** returns with a plain date based on the current timezone of the timestamp */
|
|
79
|
+
toPlainDate(): PlainDate;
|
|
80
|
+
/** returns with a plain time based on the current timezone of the timestamp */
|
|
81
|
+
toPlainTime(): PlainTime;
|
|
82
|
+
setTimezone(timezone: TimezoneInput): Timestamp;
|
|
83
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PlainDate } from '../plain-date/plain-date.js';
|
|
2
|
+
import { PlainTime } from '../plain-time/plain-time.js';
|
|
3
|
+
import { TimezoneInput } from '../common/timezone.js';
|
|
4
|
+
import { Timestamp, TimestampInput } from './timestamp.js';
|
|
5
|
+
export declare function factory(): Timestamp;
|
|
6
|
+
export declare function factory(date: undefined): Timestamp;
|
|
7
|
+
export declare function factory(date: null): null;
|
|
8
|
+
export declare function factory(date: string): Timestamp;
|
|
9
|
+
export declare function factory(date: number): Timestamp;
|
|
10
|
+
export declare function factory(date: Date): Timestamp;
|
|
11
|
+
export declare function factory(date: Timestamp): Timestamp;
|
|
12
|
+
export declare function factory(date: PlainDate): Timestamp;
|
|
13
|
+
export declare function factory(date: PlainDate | null): Timestamp | null;
|
|
14
|
+
export declare function factory(date: PlainDate, time: PlainTime, tz: TimezoneInput): Timestamp | null;
|
|
15
|
+
export declare function factory(date?: number | Date | string | null): Timestamp | null;
|
|
16
|
+
export declare function factory(date?: Timestamp | null): Timestamp | null;
|
|
17
|
+
export declare function factory(date?: number | Date | string | null): Timestamp | null;
|
|
18
|
+
export declare function factory(date: TimestampInput): Timestamp;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FutureInfinityDate } from '../plain-date/future-infinity-date.js';
|
|
2
|
+
import { PastInfinityDate } from '../plain-date/past-infinity-date.js';
|
|
3
|
+
import { DayjsTimestamp } from './dayjs-timestamp.js';
|
|
4
|
+
import { PastInfinity } from './past-infinity.js';
|
|
5
|
+
import { FutureInfinity } from './future-infinity.js';
|
|
6
|
+
export function factory(date, time, tz) {
|
|
7
|
+
if (date instanceof DayjsTimestamp
|
|
8
|
+
|| date instanceof FutureInfinity
|
|
9
|
+
|| date instanceof PastInfinity) {
|
|
10
|
+
return date;
|
|
11
|
+
}
|
|
12
|
+
switch (date) {
|
|
13
|
+
case null: return null;
|
|
14
|
+
case undefined: return new DayjsTimestamp();
|
|
15
|
+
case '-infinity': return new PastInfinity();
|
|
16
|
+
case 'infinity': return new FutureInfinity();
|
|
17
|
+
case '+infinity': return new FutureInfinity();
|
|
18
|
+
case Infinity: return new FutureInfinity();
|
|
19
|
+
case -Infinity: return new PastInfinity();
|
|
20
|
+
default: {
|
|
21
|
+
if (date instanceof DayjsTimestamp
|
|
22
|
+
|| date instanceof FutureInfinity
|
|
23
|
+
|| date instanceof PastInfinity) {
|
|
24
|
+
return date;
|
|
25
|
+
}
|
|
26
|
+
if (date instanceof FutureInfinityDate) {
|
|
27
|
+
return new FutureInfinity();
|
|
28
|
+
}
|
|
29
|
+
if (date instanceof PastInfinityDate) {
|
|
30
|
+
return new PastInfinity();
|
|
31
|
+
}
|
|
32
|
+
return new DayjsTimestamp(date, time, tz);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=timestamp.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timestamp.factory.js","sourceRoot":"","sources":["../../lib/timestamp/timestamp.factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAA;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AAG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AAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timestamp.js","sourceRoot":"","sources":["../../lib/timestamp/timestamp.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './timestamp.column.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/timestamp/typeorm/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA"}
|