@rvoh/dream 2.3.0-alpha.6 → 2.3.0-alpha.8

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.
Files changed (302) hide show
  1. package/dist/cjs/src/Dream.js +2 -40
  2. package/dist/cjs/src/cli/index.js +4 -0
  3. package/dist/cjs/src/dream/Query.js +14 -11
  4. package/dist/cjs/src/dream/QueryDriver/Base.js +0 -14
  5. package/dist/cjs/src/dream/QueryDriver/Kysely.js +86 -74
  6. package/dist/cjs/src/dream/QueryDriver/Postgres.js +10 -2
  7. package/dist/cjs/src/dream/internal/extractAssignableAssociationAttributes.js +9 -0
  8. package/dist/cjs/src/errors/db/DataIncompatibleWithDatabaseField.js +1 -3
  9. package/dist/cjs/src/helpers/areEqual.js +5 -0
  10. package/dist/cjs/src/helpers/cli/ASTBuilder.js +54 -2
  11. package/dist/cjs/src/helpers/cli/ASTKyselyCodegenEnhancer.js +84 -0
  12. package/dist/cjs/src/helpers/cli/ASTSchemaBuilder.js +17 -1
  13. package/dist/cjs/src/helpers/cli/generateFactoryContent.js +16 -0
  14. package/dist/cjs/src/helpers/cloneDeepSafe.js +21 -10
  15. package/dist/cjs/src/helpers/customPgParsers.js +18 -1
  16. package/dist/cjs/src/helpers/db/normalizeDataForDb.js +81 -0
  17. package/dist/cjs/src/helpers/db/types/helpers.js +5 -0
  18. package/dist/cjs/src/helpers/db/types/isDatetimeOrDatetimeArrayColumn.js +2 -1
  19. package/dist/cjs/src/helpers/sortBy.js +7 -5
  20. package/dist/cjs/src/helpers/sqlAttributes.js +4 -53
  21. package/dist/cjs/src/helpers/stringCasing.js +6 -5
  22. package/dist/cjs/src/helpers/toSafeObject.js +17 -0
  23. package/dist/cjs/src/package-exports/errors.js +2 -0
  24. package/dist/cjs/src/package-exports/index.js +2 -0
  25. package/dist/cjs/src/serializer/SerializerRenderer.js +11 -11
  26. package/dist/cjs/src/types/clocktime.js +1 -0
  27. package/dist/cjs/src/utils/datetime/BaseClockTime.js +363 -0
  28. package/dist/cjs/src/utils/datetime/CalendarDate.js +110 -119
  29. package/dist/cjs/src/utils/datetime/ClockTime.js +173 -0
  30. package/dist/cjs/src/utils/datetime/ClockTimeTz.js +232 -0
  31. package/dist/cjs/src/utils/datetime/DateTime.js +288 -193
  32. package/dist/cjs/src/utils/datetime/helpers/isoTimeDecimalString.js +1 -1
  33. package/dist/esm/src/Dream.js +2 -40
  34. package/dist/esm/src/cli/index.js +4 -0
  35. package/dist/esm/src/dream/Query.js +14 -11
  36. package/dist/esm/src/dream/QueryDriver/Base.js +0 -14
  37. package/dist/esm/src/dream/QueryDriver/Kysely.js +86 -74
  38. package/dist/esm/src/dream/QueryDriver/Postgres.js +10 -2
  39. package/dist/esm/src/dream/internal/extractAssignableAssociationAttributes.js +9 -0
  40. package/dist/esm/src/errors/db/DataIncompatibleWithDatabaseField.js +1 -3
  41. package/dist/esm/src/helpers/areEqual.js +5 -0
  42. package/dist/esm/src/helpers/cli/ASTBuilder.js +54 -2
  43. package/dist/esm/src/helpers/cli/ASTKyselyCodegenEnhancer.js +84 -0
  44. package/dist/esm/src/helpers/cli/ASTSchemaBuilder.js +17 -1
  45. package/dist/esm/src/helpers/cli/generateFactoryContent.js +16 -0
  46. package/dist/esm/src/helpers/cloneDeepSafe.js +21 -10
  47. package/dist/esm/src/helpers/customPgParsers.js +18 -1
  48. package/dist/esm/src/helpers/db/normalizeDataForDb.js +81 -0
  49. package/dist/esm/src/helpers/db/types/helpers.js +5 -0
  50. package/dist/esm/src/helpers/db/types/isDatetimeOrDatetimeArrayColumn.js +2 -1
  51. package/dist/esm/src/helpers/sortBy.js +7 -5
  52. package/dist/esm/src/helpers/sqlAttributes.js +4 -53
  53. package/dist/esm/src/helpers/stringCasing.js +6 -5
  54. package/dist/esm/src/helpers/toSafeObject.js +17 -0
  55. package/dist/esm/src/package-exports/errors.js +2 -0
  56. package/dist/esm/src/package-exports/index.js +2 -0
  57. package/dist/esm/src/serializer/SerializerRenderer.js +11 -11
  58. package/dist/esm/src/types/clocktime.js +1 -0
  59. package/dist/esm/src/utils/datetime/BaseClockTime.js +363 -0
  60. package/dist/esm/src/utils/datetime/CalendarDate.js +110 -119
  61. package/dist/esm/src/utils/datetime/ClockTime.js +173 -0
  62. package/dist/esm/src/utils/datetime/ClockTimeTz.js +232 -0
  63. package/dist/esm/src/utils/datetime/DateTime.js +288 -193
  64. package/dist/esm/src/utils/datetime/helpers/isoTimeDecimalString.js +1 -1
  65. package/dist/types/src/Dream.d.ts +29 -33
  66. package/dist/types/src/dream/DreamClassTransactionBuilder.d.ts +9 -10
  67. package/dist/types/src/dream/DreamInstanceTransactionBuilder.d.ts +16 -16
  68. package/dist/types/src/dream/LeftJoinLoadBuilder.d.ts +1 -1
  69. package/dist/types/src/dream/LoadBuilder.d.ts +1 -1
  70. package/dist/types/src/dream/Query.d.ts +16 -16
  71. package/dist/types/src/dream/QueryDriver/Base.d.ts +0 -1
  72. package/dist/types/src/dream/QueryDriver/Kysely.d.ts +1 -0
  73. package/dist/types/src/dream/internal/associations/associationQuery.d.ts +1 -1
  74. package/dist/types/src/dream/internal/associations/associationUpdateQuery.d.ts +1 -1
  75. package/dist/types/src/dream/internal/associations/destroyAssociation.d.ts +1 -1
  76. package/dist/types/src/dream/internal/associations/throughAssociationHasOptionsBesidesThroughAndSource.d.ts +4 -2
  77. package/dist/types/src/dream/internal/associations/undestroyAssociation.d.ts +1 -1
  78. package/dist/types/src/dream/internal/extractAssignableAssociationAttributes.d.ts +3 -0
  79. package/dist/types/src/dream/internal/similarity/SimilarityBuilder.d.ts +7 -7
  80. package/dist/types/src/errors/db/DataIncompatibleWithDatabaseField.d.ts +2 -7
  81. package/dist/types/src/helpers/cli/ASTBuilder.d.ts +31 -0
  82. package/dist/types/src/helpers/cli/ASTKyselyCodegenEnhancer.d.ts +13 -0
  83. package/dist/types/src/helpers/customPgParsers.d.ts +5 -0
  84. package/dist/types/src/helpers/db/normalizeDataForDb.d.ts +6 -0
  85. package/dist/types/src/helpers/db/types/helpers.d.ts +5 -0
  86. package/dist/types/src/helpers/sort.d.ts +2 -1
  87. package/dist/types/src/helpers/sortBy.d.ts +3 -0
  88. package/dist/types/src/helpers/toSafeObject.d.ts +8 -0
  89. package/dist/types/src/package-exports/errors.d.ts +2 -0
  90. package/dist/types/src/package-exports/index.d.ts +2 -0
  91. package/dist/types/src/package-exports/types.d.ts +2 -1
  92. package/dist/types/src/types/associations/shared.d.ts +15 -13
  93. package/dist/types/src/types/associations/shared.ts +81 -41
  94. package/dist/types/src/types/calendardate.d.ts +22 -1
  95. package/dist/types/src/types/calendardate.ts +33 -1
  96. package/dist/types/src/types/clocktime.d.ts +22 -0
  97. package/dist/types/src/types/clocktime.ts +59 -0
  98. package/dist/types/src/types/datetime.d.ts +11 -18
  99. package/dist/types/src/types/datetime.ts +16 -21
  100. package/dist/types/src/types/dream.d.ts +27 -13
  101. package/dist/types/src/types/dream.ts +40 -14
  102. package/dist/types/src/types/variadic.d.ts +10 -9
  103. package/dist/types/src/types/variadic.ts +30 -5
  104. package/dist/types/src/utils/datetime/BaseClockTime.d.ts +287 -0
  105. package/dist/types/src/utils/datetime/CalendarDate.d.ts +65 -47
  106. package/dist/types/src/utils/datetime/ClockTime.d.ts +138 -0
  107. package/dist/types/src/utils/datetime/ClockTimeTz.d.ts +194 -0
  108. package/dist/types/src/utils/datetime/DateTime.d.ts +142 -56
  109. package/dist/types/src/utils/datetime/helpers/isoTimeDecimalString.d.ts +1 -1
  110. package/docs/assets/navigation.js +1 -1
  111. package/docs/assets/search.js +1 -1
  112. package/docs/classes/db.DreamMigrationHelpers.html +9 -9
  113. package/docs/classes/db.KyselyQueryDriver.html +33 -34
  114. package/docs/classes/db.PostgresQueryDriver.html +34 -35
  115. package/docs/classes/db.QueryDriverBase.html +32 -33
  116. package/docs/classes/errors.CheckConstraintViolation.html +4 -6
  117. package/docs/classes/errors.ColumnOverflow.html +4 -6
  118. package/docs/classes/errors.CreateOrFindByFailedToCreateAndFind.html +3 -3
  119. package/docs/classes/errors.DataIncompatibleWithDatabaseField.html +4 -6
  120. package/docs/classes/errors.DataTypeColumnTypeMismatch.html +4 -6
  121. package/docs/classes/errors.GlobalNameNotSet.html +3 -3
  122. package/docs/classes/errors.InvalidCalendarDate.html +2 -2
  123. package/docs/classes/errors.InvalidClockTime.html +17 -0
  124. package/docs/classes/errors.InvalidClockTimeTz.html +17 -0
  125. package/docs/classes/errors.InvalidDateTime.html +2 -2
  126. package/docs/classes/errors.MissingSerializersDefinition.html +3 -3
  127. package/docs/classes/errors.NonLoadedAssociation.html +3 -3
  128. package/docs/classes/errors.NotNullViolation.html +4 -6
  129. package/docs/classes/errors.RecordNotFound.html +3 -3
  130. package/docs/classes/errors.ValidationError.html +3 -3
  131. package/docs/classes/index.CalendarDate.html +80 -92
  132. package/docs/classes/index.ClockTime.html +232 -0
  133. package/docs/classes/index.ClockTimeTz.html +253 -0
  134. package/docs/classes/index.DateTime.html +123 -129
  135. package/docs/classes/index.Decorators.html +19 -19
  136. package/docs/classes/index.Dream.html +127 -127
  137. package/docs/classes/index.DreamApp.html +5 -5
  138. package/docs/classes/index.DreamTransaction.html +2 -2
  139. package/docs/classes/index.Env.html +2 -2
  140. package/docs/classes/index.Query.html +71 -71
  141. package/docs/classes/system.CliFileWriter.html +2 -2
  142. package/docs/classes/system.DreamBin.html +2 -2
  143. package/docs/classes/system.DreamCLI.html +5 -5
  144. package/docs/classes/system.DreamImporter.html +2 -2
  145. package/docs/classes/system.DreamLogos.html +2 -2
  146. package/docs/classes/system.DreamSerializerBuilder.html +8 -8
  147. package/docs/classes/system.ObjectSerializerBuilder.html +8 -8
  148. package/docs/classes/system.PathHelpers.html +3 -3
  149. package/docs/classes/utils.Encrypt.html +2 -2
  150. package/docs/classes/utils.Range.html +2 -2
  151. package/docs/functions/db.closeAllDbConnections.html +1 -1
  152. package/docs/functions/db.dreamDbConnections.html +1 -1
  153. package/docs/functions/db.untypedDb.html +1 -1
  154. package/docs/functions/db.validateColumn.html +1 -1
  155. package/docs/functions/db.validateTable.html +1 -1
  156. package/docs/functions/errors.pgErrorType.html +1 -1
  157. package/docs/functions/index.DreamSerializer.html +1 -1
  158. package/docs/functions/index.ObjectSerializer.html +1 -1
  159. package/docs/functions/index.ReplicaSafe.html +1 -1
  160. package/docs/functions/index.STI.html +1 -1
  161. package/docs/functions/index.SoftDelete.html +1 -1
  162. package/docs/functions/utils.camelize.html +1 -1
  163. package/docs/functions/utils.capitalize.html +1 -1
  164. package/docs/functions/utils.cloneDeepSafe.html +1 -1
  165. package/docs/functions/utils.compact.html +1 -1
  166. package/docs/functions/utils.groupBy.html +1 -1
  167. package/docs/functions/utils.hyphenize.html +1 -1
  168. package/docs/functions/utils.intersection.html +1 -1
  169. package/docs/functions/utils.isEmpty.html +1 -1
  170. package/docs/functions/utils.normalizeUnicode.html +1 -1
  171. package/docs/functions/utils.pascalize.html +1 -1
  172. package/docs/functions/utils.percent.html +1 -1
  173. package/docs/functions/utils.range-1.html +1 -1
  174. package/docs/functions/utils.round.html +1 -1
  175. package/docs/functions/utils.sanitizeString.html +1 -1
  176. package/docs/functions/utils.snakeify.html +1 -1
  177. package/docs/functions/utils.sort.html +1 -1
  178. package/docs/functions/utils.sortBy.html +1 -1
  179. package/docs/functions/utils.sortObjectByKey.html +1 -1
  180. package/docs/functions/utils.sortObjectByValue.html +1 -1
  181. package/docs/functions/utils.uncapitalize.html +1 -1
  182. package/docs/functions/utils.uniq.html +1 -1
  183. package/docs/interfaces/openapi.OpenapiDescription.html +2 -2
  184. package/docs/interfaces/openapi.OpenapiSchemaProperties.html +1 -1
  185. package/docs/interfaces/openapi.OpenapiSchemaPropertiesShorthand.html +1 -1
  186. package/docs/interfaces/openapi.OpenapiTypeFieldObject.html +1 -1
  187. package/docs/interfaces/types.BelongsToStatement.html +2 -2
  188. package/docs/interfaces/types.DecoratorContext.html +2 -2
  189. package/docs/interfaces/types.DreamAppInitOptions.html +2 -2
  190. package/docs/interfaces/types.DreamAppOpts.html +2 -2
  191. package/docs/interfaces/types.DurationObject.html +5 -5
  192. package/docs/interfaces/types.EncryptOptions.html +2 -2
  193. package/docs/interfaces/types.InternalAnyTypedSerializerRendersMany.html +2 -2
  194. package/docs/interfaces/types.InternalAnyTypedSerializerRendersOne.html +2 -2
  195. package/docs/interfaces/types.SerializerRendererOpts.html +2 -2
  196. package/docs/modules/db.html +1 -1
  197. package/docs/modules/errors.html +3 -1
  198. package/docs/modules/index.html +3 -1
  199. package/docs/modules/openapi.html +1 -1
  200. package/docs/modules/system.html +1 -1
  201. package/docs/modules/types.html +3 -1
  202. package/docs/modules/utils.html +1 -1
  203. package/docs/types/openapi.CommonOpenapiSchemaObjectFields.html +1 -1
  204. package/docs/types/openapi.OpenapiAllTypes.html +1 -1
  205. package/docs/types/openapi.OpenapiFormats.html +1 -1
  206. package/docs/types/openapi.OpenapiNumberFormats.html +1 -1
  207. package/docs/types/openapi.OpenapiPrimitiveBaseTypes.html +1 -1
  208. package/docs/types/openapi.OpenapiPrimitiveTypes.html +1 -1
  209. package/docs/types/openapi.OpenapiSchemaArray.html +1 -1
  210. package/docs/types/openapi.OpenapiSchemaArrayShorthand.html +1 -1
  211. package/docs/types/openapi.OpenapiSchemaBase.html +1 -1
  212. package/docs/types/openapi.OpenapiSchemaBody.html +1 -1
  213. package/docs/types/openapi.OpenapiSchemaBodyShorthand.html +1 -1
  214. package/docs/types/openapi.OpenapiSchemaCommonFields.html +1 -1
  215. package/docs/types/openapi.OpenapiSchemaExpressionAllOf.html +1 -1
  216. package/docs/types/openapi.OpenapiSchemaExpressionAnyOf.html +1 -1
  217. package/docs/types/openapi.OpenapiSchemaExpressionOneOf.html +1 -1
  218. package/docs/types/openapi.OpenapiSchemaExpressionRef.html +1 -1
  219. package/docs/types/openapi.OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
  220. package/docs/types/openapi.OpenapiSchemaInteger.html +1 -1
  221. package/docs/types/openapi.OpenapiSchemaNull.html +1 -1
  222. package/docs/types/openapi.OpenapiSchemaNumber.html +1 -1
  223. package/docs/types/openapi.OpenapiSchemaObject.html +1 -1
  224. package/docs/types/openapi.OpenapiSchemaObjectAllOf.html +1 -1
  225. package/docs/types/openapi.OpenapiSchemaObjectAllOfShorthand.html +1 -1
  226. package/docs/types/openapi.OpenapiSchemaObjectAnyOf.html +1 -1
  227. package/docs/types/openapi.OpenapiSchemaObjectAnyOfShorthand.html +1 -1
  228. package/docs/types/openapi.OpenapiSchemaObjectBase.html +1 -1
  229. package/docs/types/openapi.OpenapiSchemaObjectBaseShorthand.html +1 -1
  230. package/docs/types/openapi.OpenapiSchemaObjectOneOf.html +1 -1
  231. package/docs/types/openapi.OpenapiSchemaObjectOneOfShorthand.html +1 -1
  232. package/docs/types/openapi.OpenapiSchemaObjectShorthand.html +1 -1
  233. package/docs/types/openapi.OpenapiSchemaPrimitiveGeneric.html +1 -1
  234. package/docs/types/openapi.OpenapiSchemaShorthandExpressionAllOf.html +1 -1
  235. package/docs/types/openapi.OpenapiSchemaShorthandExpressionAnyOf.html +1 -1
  236. package/docs/types/openapi.OpenapiSchemaShorthandExpressionOneOf.html +1 -1
  237. package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializableRef.html +1 -1
  238. package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializerRef.html +1 -1
  239. package/docs/types/openapi.OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
  240. package/docs/types/openapi.OpenapiSchemaString.html +1 -1
  241. package/docs/types/openapi.OpenapiShorthandAllTypes.html +1 -1
  242. package/docs/types/openapi.OpenapiShorthandPrimitiveBaseTypes.html +1 -1
  243. package/docs/types/openapi.OpenapiShorthandPrimitiveTypes.html +1 -1
  244. package/docs/types/openapi.OpenapiTypeField.html +1 -1
  245. package/docs/types/system.DreamAppAllowedPackageManagersEnum.html +1 -1
  246. package/docs/types/types.CalendarDateDurationUnit.html +1 -1
  247. package/docs/types/types.CalendarDateObject.html +2 -0
  248. package/docs/types/types.Camelized.html +1 -1
  249. package/docs/types/types.ClockTimeObject.html +2 -0
  250. package/docs/types/types.DbConnectionType.html +1 -1
  251. package/docs/types/types.DbTypes.html +1 -1
  252. package/docs/types/types.DreamAssociationMetadata.html +1 -1
  253. package/docs/types/types.DreamAttributes.html +1 -1
  254. package/docs/types/types.DreamClassAssociationAndStatement.html +1 -1
  255. package/docs/types/types.DreamClassColumn.html +1 -1
  256. package/docs/types/types.DreamColumn.html +1 -1
  257. package/docs/types/types.DreamColumnNames.html +1 -1
  258. package/docs/types/types.DreamLogLevel.html +1 -1
  259. package/docs/types/types.DreamLogger.html +1 -1
  260. package/docs/types/types.DreamModelSerializerType.html +1 -1
  261. package/docs/types/types.DreamOrViewModelClassSerializerKey.html +1 -1
  262. package/docs/types/types.DreamOrViewModelSerializerKey.html +1 -1
  263. package/docs/types/types.DreamParamSafeAttributes.html +1 -1
  264. package/docs/types/types.DreamParamSafeColumnNames.html +1 -1
  265. package/docs/types/types.DreamSerializable.html +1 -1
  266. package/docs/types/types.DreamSerializableArray.html +1 -1
  267. package/docs/types/types.DreamSerializerKey.html +1 -1
  268. package/docs/types/types.DreamSerializers.html +1 -1
  269. package/docs/types/types.DreamVirtualColumns.html +1 -1
  270. package/docs/types/types.DurationUnit.html +2 -4
  271. package/docs/types/types.EncryptAlgorithm.html +1 -1
  272. package/docs/types/types.HasManyStatement.html +1 -1
  273. package/docs/types/types.HasOneStatement.html +1 -1
  274. package/docs/types/types.Hyphenized.html +1 -1
  275. package/docs/types/types.Pascalized.html +1 -1
  276. package/docs/types/types.PrimaryKeyType.html +1 -1
  277. package/docs/types/types.RoundingPrecision.html +1 -1
  278. package/docs/types/types.SerializerCasing.html +1 -1
  279. package/docs/types/types.SimpleObjectSerializerType.html +1 -1
  280. package/docs/types/types.Snakeified.html +1 -1
  281. package/docs/types/types.StrictInterface.html +1 -1
  282. package/docs/types/types.UpdateableAssociationProperties.html +1 -1
  283. package/docs/types/types.UpdateableProperties.html +1 -1
  284. package/docs/types/types.ValidationType.html +1 -1
  285. package/docs/types/types.ViewModel.html +1 -1
  286. package/docs/types/types.ViewModelClass.html +1 -1
  287. package/docs/types/types.WeekdayName.html +1 -1
  288. package/docs/types/types.WhereStatementForDream.html +1 -1
  289. package/docs/types/types.WhereStatementForDreamClass.html +1 -1
  290. package/docs/variables/index.DreamConst.html +1 -1
  291. package/docs/variables/index.ops.html +1 -1
  292. package/docs/variables/openapi.openapiPrimitiveTypes-1.html +1 -1
  293. package/docs/variables/openapi.openapiShorthandPrimitiveTypes-1.html +1 -1
  294. package/docs/variables/system.DreamAppAllowedPackageManagersEnumValues.html +1 -1
  295. package/docs/variables/system.primaryKeyTypes.html +1 -1
  296. package/package.json +2 -2
  297. package/dist/cjs/src/helpers/db/types/isDateOrDateArrayColumn.js +0 -3
  298. package/dist/cjs/src/helpers/db/types/isTextOrTextArrayColumn.js +0 -3
  299. package/dist/esm/src/helpers/db/types/isDateOrDateArrayColumn.js +0 -3
  300. package/dist/esm/src/helpers/db/types/isTextOrTextArrayColumn.js +0 -3
  301. package/dist/types/src/helpers/db/types/isDateOrDateArrayColumn.d.ts +0 -2
  302. package/dist/types/src/helpers/db/types/isTextOrTextArrayColumn.d.ts +0 -2
@@ -1,5 +1,5 @@
1
- import { CalendarDateDurationLike, CalendarDateDurationUnit, CalendarDateUnit } from '../../types/calendardate.js';
2
- import { type DateTimeJSOptions, type DateTimeObject, type LocaleOptions, type WeekdayName, type Zone } from '../../types/datetime.js';
1
+ import { CalendarDateDiffResult, CalendarDateDurationLike, CalendarDateDurationUnit, CalendarDateUnit, type CalendarDateObject } from '../../types/calendardate.js';
2
+ import { type DateTimeJSOptions, type DateTimeOptions, type LocaleOptions, type WeekdayName, type Zone } from '../../types/datetime.js';
3
3
  import { DateTime } from './DateTime.js';
4
4
  /**
5
5
  * CalendarDate represents a date without time or timezone information.
@@ -7,18 +7,9 @@ import { DateTime } from './DateTime.js';
7
7
  export default class CalendarDate {
8
8
  protected readonly dateTime: DateTime;
9
9
  /**
10
- * Creates a CalendarDate from a DateTime, year/month/day, or defaults to today in UTC.
11
- * @param source - DateTime instance, year number, or null/undefined for today
12
- * @param month - Month (1-12) when source is a year number
13
- * @param day - Day of month when source is a year number
14
- * @example
15
- * ```ts
16
- * new CalendarDate() // today
17
- * new CalendarDate(DateTime.now()) // from DateTime
18
- * new CalendarDate(2026, 2, 7) // February 7, 2026
19
- * ```
10
+ * @internal
20
11
  */
21
- constructor(source?: DateTime | number | null, month?: number, day?: number);
12
+ constructor(source?: DateTime | CalendarDateObject | null);
22
13
  /**
23
14
  * Create a CalendarDate from a DateTime instance.
24
15
  * @param dateTime - A DateTime instance
@@ -40,7 +31,7 @@ export default class CalendarDate {
40
31
  * CalendarDate.fromJSDate(new Date(), { zone: 'America/New_York' })
41
32
  * ```
42
33
  */
43
- static fromJSDate(javascriptDate: Date, { zone }?: {
34
+ static fromJSDate(javascriptDate: Date, opts?: {
44
35
  zone?: string | Zone;
45
36
  }): CalendarDate;
46
37
  /**
@@ -52,10 +43,9 @@ export default class CalendarDate {
52
43
  * @example
53
44
  * ```ts
54
45
  * CalendarDate.fromISO('2026-02-07')
55
- * CalendarDate.fromISO('2026-02-07T09:00:00Z') // time portion ignored
56
46
  * ```
57
47
  */
58
- static fromISO(str: string, { zone }?: {
48
+ static fromISO(str: string, opts?: {
59
49
  zone?: string | Zone;
60
50
  }): CalendarDate;
61
51
  /**
@@ -84,10 +74,7 @@ export default class CalendarDate {
84
74
  * CalendarDate.fromFormat('mai 25, 1982', 'MMMM dd, yyyy', { locale: 'fr' })
85
75
  * ```
86
76
  */
87
- static fromFormat(text: string, format: string, { zone, locale }?: {
88
- zone?: string | Zone;
89
- locale?: string;
90
- }): CalendarDate;
77
+ static fromFormat(text: string, format: string, opts?: DateTimeOptions): CalendarDate;
91
78
  /**
92
79
  * Create a CalendarDate from an object with date units.
93
80
  * @param obj - Object with year, month, day properties
@@ -99,7 +86,7 @@ export default class CalendarDate {
99
86
  * CalendarDate.fromObject({ year: 2026, month: 2, day: 7 })
100
87
  * ```
101
88
  */
102
- static fromObject(obj: DateTimeObject, opts?: DateTimeJSOptions): CalendarDate;
89
+ static fromObject(obj: CalendarDateObject, opts?: DateTimeJSOptions): CalendarDate;
103
90
  /**
104
91
  * Returns a CalendarDate for today's date.
105
92
  * @param options - Optional zone (defaults to UTC)
@@ -110,7 +97,7 @@ export default class CalendarDate {
110
97
  * CalendarDate.today({ zone: 'America/New_York' })
111
98
  * ```
112
99
  */
113
- static today({ zone }?: {
100
+ static today(opts?: {
114
101
  zone?: string | Zone;
115
102
  }): CalendarDate;
116
103
  /**
@@ -148,6 +135,17 @@ export default class CalendarDate {
148
135
  * ```
149
136
  */
150
137
  toISO(): string;
138
+ /**
139
+ * Returns the date as an ISO date string.
140
+ * Alias for `toISO()`.
141
+ *
142
+ * @returns ISO date string (e.g., '2026-02-07')
143
+ * @example
144
+ * ```ts
145
+ * CalendarDate.fromObject({ year: 2026, month: 2, day: 7 }).toISODate() // '2026-02-07'
146
+ * ```
147
+ */
148
+ toISODate(): string;
151
149
  /**
152
150
  * Returns the date as an SQL date string.
153
151
  * @returns SQL date string (e.g., '2026-02-07')
@@ -156,6 +154,7 @@ export default class CalendarDate {
156
154
  * CalendarDate.fromObject({ year: 2026, month: 2, day: 7 }).toSQL() // '2026-02-07'
157
155
  * ```
158
156
  */
157
+ private _toSQL;
159
158
  toSQL(): string;
160
159
  /**
161
160
  * Returns the date as an ISO string for JSON serialization.
@@ -167,23 +166,15 @@ export default class CalendarDate {
167
166
  */
168
167
  toJSON(): string;
169
168
  /**
170
- * Returns the epoch milliseconds for the date at midnight UTC.
171
- * @returns Unix timestamp in milliseconds
172
- * @example
173
- * ```ts
174
- * CalendarDate.fromISO('2026-02-07').valueOf()
175
- * ```
176
- */
177
- valueOf(): number;
178
- /**
179
- * Returns the date as an ISO date string (same as toISO).
169
+ * Returns the date as an ISO date string (for valueOf() operations).
180
170
  * @returns ISO date string (e.g., '2026-02-07')
181
171
  * @example
182
172
  * ```ts
183
- * CalendarDate.fromObject({ year: 2026, month: 2, day: 7 }).toISODate() // '2026-02-07'
173
+ * CalendarDate.fromISO('2026-02-07').valueOf()
184
174
  * ```
185
175
  */
186
- toISODate(): string;
176
+ private _valueOf;
177
+ valueOf(): string;
187
178
  /**
188
179
  * Returns a localized string representation of the date.
189
180
  * @param formatOpts - Intl.DateTimeFormat options for formatting
@@ -305,15 +296,16 @@ export default class CalendarDate {
305
296
  */
306
297
  minus(duration: CalendarDateDurationLike): CalendarDate;
307
298
  /**
308
- * Returns the latest CalendarDate from the given arguments.
309
- * @param calendarDates - CalendarDates to compare
310
- * @returns The latest CalendarDate
299
+ * Returns a new CalendarDate with the given date units set.
300
+ * @param values - Object with date units to set (year, month, day)
301
+ * @returns A new CalendarDate
302
+ * @throws {InvalidCalendarDate} When the underlying DateTime operation fails
311
303
  * @example
312
304
  * ```ts
313
- * CalendarDate.max(date1, date2, date3)
305
+ * CalendarDate.fromISO('2026-02-07').set({ year: 2025, day: 15 }) // 2025-02-15
314
306
  * ```
315
307
  */
316
- static max(...calendarDates: Array<CalendarDate>): CalendarDate;
308
+ set(values: Partial<CalendarDateObject>): CalendarDate;
317
309
  /**
318
310
  * Returns the earliest CalendarDate from the given arguments.
319
311
  * @param calendarDates - CalendarDates to compare
@@ -323,7 +315,17 @@ export default class CalendarDate {
323
315
  * CalendarDate.min(date1, date2, date3)
324
316
  * ```
325
317
  */
326
- static min(...calendarDates: Array<CalendarDate>): CalendarDate;
318
+ static min(...calendarDates: CalendarDate[]): CalendarDate | null;
319
+ /**
320
+ * Returns the latest CalendarDate from the given arguments.
321
+ * @param calendarDates - CalendarDates to compare
322
+ * @returns The latest CalendarDate
323
+ * @example
324
+ * ```ts
325
+ * CalendarDate.max(date1, date2, date3)
326
+ * ```
327
+ */
328
+ static max(...calendarDates: CalendarDate[]): CalendarDate | null;
327
329
  /**
328
330
  * Returns true if this and other are in the same unit of time.
329
331
  * @param otherCalendarDate - CalendarDate to compare against
@@ -348,21 +350,37 @@ export default class CalendarDate {
348
350
  * const d1 = CalendarDate.fromISO('2026-02-07')
349
351
  * const d2 = CalendarDate.fromISO('2026-02-15')
350
352
  * d2.diff(d1, 'days') // 8
351
- * d2.diff(d1, 'months') // 0
352
353
  * ```
353
354
  */
354
- diff(otherCalendarDate: CalendarDate, duration: CalendarDateDurationUnit): number;
355
355
  /**
356
- * Returns the difference between this CalendarDate and today in the specified unit.
357
- * @param duration - Unit for the difference ('years', 'quarters', 'months', 'weeks', or 'days')
358
- * @returns Numeric difference in the specified unit (rounded up)
356
+ * Returns the difference between this CalendarDate and another in the specified unit(s).
357
+ *
358
+ * @param other - CalendarDate to compare against
359
+ * @param unit - Unit or units to return (years, quarters, months, weeks, days)
360
+ * @returns Object with only the specified units (or all units if not specified)
361
+ * @example
362
+ * ```ts
363
+ * const d1 = CalendarDate.fromISO('2026-02-15')
364
+ * const d2 = CalendarDate.fromISO('2026-02-07')
365
+ * d1.diff(d2, 'days') // { days: 8 }
366
+ * d1.diff(d2, ['months', 'days']) // { months: 0, days: 8 }
367
+ * d1.diff(d2) // { years: 0, months: 0, days: 8 }
368
+ * ```
369
+ */
370
+ diff<U extends CalendarDateDurationUnit | CalendarDateDurationUnit[] | undefined = undefined>(other: CalendarDate, unit?: U): CalendarDateDiffResult<U>;
371
+ /**
372
+ * Returns the difference between this CalendarDate and today in the specified unit(s).
373
+ *
374
+ * @param unit - Unit or units to return (years, quarters, months, weeks, days)
375
+ * @returns Object with only the specified units (or all units if not specified)
359
376
  * @example
360
377
  * ```ts
361
378
  * const future = CalendarDate.today().plus({ days: 5 })
362
- * future.diffNow('days') // approximately 5
379
+ * future.diffNow('days') // { days: 5 }
380
+ * future.diffNow(['months', 'days']) // { months: 0, days: 5 }
363
381
  * ```
364
382
  */
365
- diffNow(duration: CalendarDateDurationUnit): number;
383
+ diffNow<U extends CalendarDateDurationUnit | CalendarDateDurationUnit[] | undefined = undefined>(unit?: U): CalendarDateDiffResult<U>;
366
384
  /**
367
385
  * Returns true if this CalendarDate equals another CalendarDate.
368
386
  * @param otherCalendarDate - CalendarDate to compare
@@ -0,0 +1,138 @@
1
+ import { type ClockTimeObject } from '../../types/clocktime.js';
2
+ import { type LocaleOptions } from '../../types/datetime.js';
3
+ import BaseClockTime from './BaseClockTime.js';
4
+ /**
5
+ * ClockTime represents a time of day without timezone information.
6
+ *
7
+ * Useful for representing TIME WITHOUT TIME ZONE fields from a Postgres database.
8
+ * All output methods strip timezone offset information.
9
+ */
10
+ export default class ClockTime extends BaseClockTime {
11
+ /**
12
+ * Create a ClockTime from a JavaScript Date.
13
+ * @param javascriptDate - A JavaScript Date instance
14
+ * @returns A ClockTime for the time portion
15
+ * @example
16
+ * ```ts
17
+ * ClockTime.fromJSDate(new Date())
18
+ * ```
19
+ */
20
+ static fromJSDate(javascriptDate: Date): ClockTime;
21
+ /**
22
+ * Create a ClockTime from an ISO 8601 time string.
23
+ * Preserves the time values as-is, regardless of any timezone info in the string.
24
+ * @param str - ISO time string (e.g., '14:30:45.123456')
25
+ * @returns A ClockTime for the given time
26
+ * @throws {InvalidClockTime} When the ISO string is invalid
27
+ * @example
28
+ * ```ts
29
+ * ClockTime.fromISO('14:30:45.123456') // stores 14:30:45.123456
30
+ * ClockTime.fromISO('14:30:45.123456-05:00') // stores 14:30:45.123456 (timezone ignored)
31
+ * ```
32
+ */
33
+ static fromISO(str: string): ClockTime;
34
+ /**
35
+ * Create a ClockTime from an SQL time string.
36
+ * Preserves the time values as-is, regardless of any timezone info in the string.
37
+ * @param str - SQL time string (e.g., '14:30:45.123456')
38
+ * @returns A ClockTime for the given time
39
+ * @throws {InvalidClockTime} When the SQL string is invalid
40
+ * @example
41
+ * ```ts
42
+ * ClockTime.fromSQL('14:30:45.123456') // stores 14:30:45.123456
43
+ * ClockTime.fromSQL('14:30:45.123456+05:30') // stores 14:30:45.123456 (timezone ignored)
44
+ * ```
45
+ */
46
+ static fromSQL(str: string): ClockTime;
47
+ /**
48
+ * Create a ClockTime from a custom format string.
49
+ * Uses Luxon format tokens (e.g., 'HH:mm:ss', 'hh:mm a').
50
+ * @param text - The string to parse
51
+ * @param format - Format string using Luxon tokens
52
+ * @param opts - Optional configuration
53
+ * @param opts.locale - Locale for parsing (e.g., 'en-US', 'fr-FR')
54
+ * @param opts.numberingSystem - Numbering system (e.g., 'arab', 'beng')
55
+ * @param opts.outputCalendar - Output calendar system (e.g., 'islamic', 'hebrew')
56
+ * @returns A ClockTime for the parsed time
57
+ * @throws {InvalidClockTime} When the string doesn't match the format or is invalid
58
+ * @example
59
+ * ```ts
60
+ * ClockTime.fromFormat('14:30:45', 'HH:mm:ss')
61
+ * ClockTime.fromFormat('2:30 PM', 'h:mm a')
62
+ * ```
63
+ */
64
+ static fromFormat(text: string, format: string, opts?: LocaleOptions): ClockTime;
65
+ /**
66
+ * Create a ClockTime from an object with time units.
67
+ * @param obj - Object with hour, minute, second, millisecond, microsecond properties
68
+ * @param opts - Optional configuration
69
+ * @param opts.locale - Locale (e.g., 'en-US', 'fr-FR')
70
+ * @param opts.numberingSystem - Numbering system (e.g., 'arab', 'beng')
71
+ * @param opts.outputCalendar - Output calendar system (e.g., 'islamic', 'hebrew')
72
+ * @returns A ClockTime for the given components
73
+ * @throws {InvalidClockTime} When time values are invalid
74
+ * @example
75
+ * ```ts
76
+ * ClockTime.fromObject({ hour: 14, minute: 30, second: 45 })
77
+ * ClockTime.fromObject({ hour: 14, minute: 30 })
78
+ * ```
79
+ */
80
+ static fromObject(obj: Partial<ClockTimeObject>, opts?: LocaleOptions): ClockTime;
81
+ /**
82
+ * Returns a ClockTime for the current time.
83
+ * @returns A ClockTime for now
84
+ * @example
85
+ * ```ts
86
+ * ClockTime.now()
87
+ * ```
88
+ */
89
+ static now(): ClockTime;
90
+ /**
91
+ * Returns the time as an ISO 8601 time string without timezone offset.
92
+ * Alias for `toISOTime()`.
93
+ *
94
+ * @param opts - Optional format options
95
+ * @param opts.suppressMilliseconds - If true, omits milliseconds/microseconds when they are zero
96
+ * @param opts.suppressSeconds - If true, omits seconds when they are zero
97
+ * @param opts.format - Format variant: 'basic' (compact) or 'extended' (default, with colons)
98
+ * @returns ISO time string without timezone offset (e.g., '14:30:45.123456')
99
+ * @example
100
+ * ```ts
101
+ * ClockTime.fromObject({ hour: 14, minute: 30, second: 45 }).toISO() // '14:30:45.000000'
102
+ * ClockTime.fromISO('14:30:45-05:00').toISO() // '14:30:45.000000' (timezone stripped)
103
+ * ```
104
+ */
105
+ toISO(opts?: {
106
+ suppressMilliseconds?: boolean;
107
+ suppressSeconds?: boolean;
108
+ format?: 'basic' | 'extended';
109
+ }): string;
110
+ /**
111
+ * Returns the SQL time string without timezone offset.
112
+ * Result is memoized for performance.
113
+ *
114
+ * @returns SQL time string without timezone offset (e.g., '14:30:45.123456')
115
+ * @example
116
+ * ```ts
117
+ * ClockTime.fromISO('14:30:45').toSQL() // '14:30:45.000000'
118
+ * ```
119
+ */
120
+ toSQL(): string;
121
+ protected static wrapLuxonError<T>(fn: () => T): T;
122
+ protected wrapLuxonError<T>(fn: () => T): T;
123
+ }
124
+ /**
125
+ * Thrown when a ClockTime is invalid (e.g., invalid input or time values).
126
+ * @param error - The original error (available as cause)
127
+ * @example
128
+ * ```ts
129
+ * try {
130
+ * ClockTime.fromISO('25:00:00')
131
+ * } catch (e) {
132
+ * if (e instanceof InvalidClockTime) console.error(e.message)
133
+ * }
134
+ * ```
135
+ */
136
+ export declare class InvalidClockTime extends Error {
137
+ constructor(error: Error);
138
+ }
@@ -0,0 +1,194 @@
1
+ import { type ClockTimeObject } from '../../types/clocktime.js';
2
+ import { type DateTimeJSOptions, type DateTimeOptions, type Zone } from '../../types/datetime.js';
3
+ import BaseClockTime from './BaseClockTime.js';
4
+ /**
5
+ * ClockTimeTz represents a time of day with timezone information.
6
+ *
7
+ * Useful for representing TIME WITH TIME ZONE fields from a Postgres database.
8
+ * All output methods include timezone offset information.
9
+ */
10
+ export default class ClockTimeTz extends BaseClockTime {
11
+ /**
12
+ * Create a ClockTimeTz from a JavaScript Date.
13
+ * @param javascriptDate - A JavaScript Date instance
14
+ * @param options - Optional configuration
15
+ * @param options.zone - Timezone to interpret the date in (IANA timezone name or Zone object)
16
+ * @returns A ClockTimeTz for the time portion
17
+ * @example
18
+ * ```ts
19
+ * ClockTimeTz.fromJSDate(new Date())
20
+ * ClockTimeTz.fromJSDate(new Date(), { zone: 'America/New_York' })
21
+ * ```
22
+ */
23
+ static fromJSDate(javascriptDate: Date, opts?: {
24
+ zone?: string | Zone;
25
+ }): ClockTimeTz;
26
+ /**
27
+ * Create a ClockTimeTz from an ISO 8601 time string.
28
+ * If the string includes timezone information, it will be used.
29
+ * If no timezone is in the string, it will be interpreted as UTC.
30
+ * @param str - ISO time string (e.g., '14:30:45.123456-05:00')
31
+ * @param options - Optional configuration
32
+ * @param options.zone - Timezone to interpret the time in (overrides timezone in string)
33
+ * @returns A ClockTimeTz for the given time
34
+ * @throws {InvalidClockTimeTz} When the ISO string is invalid
35
+ * @example
36
+ * ```ts
37
+ * ClockTimeTz.fromISO('14:30:45.123456') // Interpreted as UTC
38
+ * ClockTimeTz.fromISO('14:30:45.123456-05:00') // Uses timezone from string
39
+ * ```
40
+ */
41
+ static fromISO(str: string, opts?: {
42
+ zone?: string | Zone;
43
+ }): ClockTimeTz;
44
+ /**
45
+ * Create a ClockTimeTz from an SQL time string.
46
+ * If no zone option is provided, the time will be interpreted as UTC.
47
+ * @param str - SQL time string (e.g., '14:30:45.123456')
48
+ * @param options - Optional configuration
49
+ * @param options.zone - Timezone to interpret the time in (overrides timezone in string)
50
+ * @returns A ClockTimeTz for the given time
51
+ * @throws {InvalidClockTimeTz} When the SQL string is invalid
52
+ * @example
53
+ * ```ts
54
+ * ClockTimeTz.fromSQL('14:30:45.123456') // Interpreted as UTC
55
+ * ClockTimeTz.fromSQL('14:30:45.123456+05:30') // Uses timezone from string
56
+ * ClockTimeTz.fromSQL('14:30:45', { zone: 'America/Chicago' }) // Uses specified zone
57
+ * ```
58
+ */
59
+ static fromSQL(str: string, opts?: {
60
+ zone?: string | Zone;
61
+ }): ClockTimeTz;
62
+ /**
63
+ * Create a ClockTimeTz from a custom format string.
64
+ * Uses Luxon format tokens (e.g., 'HH:mm:ss', 'hh:mm a').
65
+ * @param text - The string to parse
66
+ * @param format - Format string using Luxon tokens
67
+ * @param opts - Optional configuration
68
+ * @param opts.zone - Timezone to interpret the time in (IANA timezone name or Zone object)
69
+ * @param opts.locale - Locale for parsing (e.g., 'en-US', 'fr-FR')
70
+ * @param opts.numberingSystem - Numbering system (e.g., 'arab', 'beng')
71
+ * @param opts.outputCalendar - Output calendar system (e.g., 'islamic', 'hebrew')
72
+ * @returns A ClockTimeTz for the parsed time
73
+ * @throws {InvalidClockTimeTz} When the string doesn't match the format or is invalid
74
+ * @example
75
+ * ```ts
76
+ * ClockTimeTz.fromFormat('14:30:45', 'HH:mm:ss')
77
+ * ClockTimeTz.fromFormat('2:30 PM', 'h:mm a')
78
+ * ClockTimeTz.fromFormat('14:30:45 -05:00', 'HH:mm:ss ZZ')
79
+ * ```
80
+ */
81
+ static fromFormat(text: string, format: string, opts?: DateTimeOptions): ClockTimeTz;
82
+ /**
83
+ * Create a ClockTimeTz from an object with time units.
84
+ * @param obj - Object with hour, minute, second, millisecond, microsecond properties
85
+ * @param opts - Optional configuration
86
+ * @param opts.zone - Timezone for the time (IANA timezone name or Zone object, defaults to UTC)
87
+ * @param opts.locale - Locale (e.g., 'en-US', 'fr-FR')
88
+ * @param opts.numberingSystem - Numbering system (e.g., 'arab', 'beng')
89
+ * @param opts.outputCalendar - Output calendar system (e.g., 'islamic', 'hebrew')
90
+ * @returns A ClockTimeTz for the given components
91
+ * @throws {InvalidClockTimeTz} When time values are invalid
92
+ * @example
93
+ * ```ts
94
+ * ClockTimeTz.fromObject({ hour: 14, minute: 30, second: 45 }) // UTC by default
95
+ *
96
+ * // Note for when sending a named, non-UTC time zone, soch as 'America/New_York':
97
+ * // Sending a non-UTC time zone will interpret the time zone based on DateTime.now,
98
+ * // meaning the resulting ClockTimeTz will have a different time and offset when
99
+ * // generated during daylight savings time than not during daylight savings time
100
+ * ClockTimeTz.fromObject({ hour: 14, minute: 30 }, { zone: 'America/New_York' })
101
+ * ```
102
+ */
103
+ static fromObject(obj: Partial<ClockTimeObject>, opts?: DateTimeJSOptions): ClockTimeTz;
104
+ /**
105
+ * Returns the time as an ISO 8601 time string with timezone offset.
106
+ * Alias for `toISOTime()`.
107
+ *
108
+ * @param opts - Optional format options
109
+ * @param opts.suppressMilliseconds - If true, omits milliseconds/microseconds when they are zero
110
+ * @param opts.suppressSeconds - If true, omits seconds when they are zero
111
+ * @param opts.format - Format variant: 'basic' (compact) or 'extended' (default, with colons)
112
+ * @returns ISO time string with timezone offset (e.g., '14:30:45.123456-05:00')
113
+ * @example
114
+ * ```ts
115
+ * ClockTimeTz.fromObject({ hour: 14, minute: 30, second: 45 }).toISO() // '14:30:45.000000+00:00'
116
+ * ClockTimeTz.fromISO('14:30:45-05:00').toISO() // '14:30:45.000000-05:00'
117
+ * ```
118
+ */
119
+ toISO(opts?: {
120
+ suppressMilliseconds?: boolean;
121
+ suppressSeconds?: boolean;
122
+ format?: 'basic' | 'extended';
123
+ }): string;
124
+ /**
125
+ * Returns the SQL time string with timezone offset.
126
+ * Result is memoized for performance.
127
+ *
128
+ * @returns SQL time string with timezone offset (e.g., '14:30:45.123456 -05:00')
129
+ * @example
130
+ * ```ts
131
+ * ClockTimeTz.fromISO('14:30:45-05:00').toSQL() // '14:30:45.000000 -05:00'
132
+ * ```
133
+ */
134
+ toSQL(): string;
135
+ /**
136
+ * Gets the timezone name.
137
+ * @returns The timezone name
138
+ * @example
139
+ * ```ts
140
+ * ClockTimeTz.fromObject({ hour: 14 }, { zone: 'America/New_York' }).zoneName
141
+ * ```
142
+ */
143
+ get zoneName(): string;
144
+ /**
145
+ * Gets the timezone offset in minutes.
146
+ * @returns The offset in minutes
147
+ * @example
148
+ * ```ts
149
+ * ClockTimeTz.fromISO('14:30:45-05:00').offset // -300
150
+ * ```
151
+ */
152
+ get offset(): number;
153
+ /**
154
+ * Returns a ClockTime for the current time.
155
+ * @returns A ClockTime for now
156
+ * @example
157
+ * ```ts
158
+ * ClockTime.now()
159
+ * ```
160
+ */
161
+ static now(opts?: {
162
+ zone?: string | Zone;
163
+ }): ClockTimeTz;
164
+ /**
165
+ * Returns a new ClockTimeTz with the timezone changed.
166
+ * The time value changes to reflect the same instant in the new timezone.
167
+ * @param zone - The timezone to convert to
168
+ * @returns A new ClockTimeTz in the specified timezone
169
+ * @example
170
+ * ```ts
171
+ * const utc = ClockTimeTz.fromObject({ hour: 14, minute: 30 }, { zone: 'UTC' })
172
+ * const ny = utc.setZone('America/New_York')
173
+ * // Time is converted to New York timezone (e.g., 09:30 EST)
174
+ * ```
175
+ */
176
+ setZone(zone: string | Zone): ClockTimeTz;
177
+ protected static wrapLuxonError<T>(fn: () => T): T;
178
+ protected wrapLuxonError<T>(fn: () => T): T;
179
+ }
180
+ /**
181
+ * Thrown when a ClockTimeTz is invalid (e.g., invalid input or time values).
182
+ * @param error - The original error (available as cause)
183
+ * @example
184
+ * ```ts
185
+ * try {
186
+ * ClockTimeTz.fromISO('25:00:00')
187
+ * } catch (e) {
188
+ * if (e instanceof InvalidClockTimeTz) console.error(e.message)
189
+ * }
190
+ * ```
191
+ */
192
+ export declare class InvalidClockTimeTz extends Error {
193
+ constructor(error: Error);
194
+ }