@rvoh/dream 2.2.2 → 2.3.0-alpha.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.
Files changed (300) hide show
  1. package/dist/cjs/src/Dream.js +10 -15
  2. package/dist/cjs/src/db/dataTypes.js +1 -0
  3. package/dist/cjs/src/db/index.js +2 -2
  4. package/dist/cjs/src/dream/QueryDriver/Base.js +2 -2
  5. package/dist/cjs/src/dream/QueryDriver/Kysely.js +2 -2
  6. package/dist/cjs/src/dream/QueryDriver/helpers/kysely/checkForNeedToBeRunMigrations.js +2 -2
  7. package/dist/cjs/src/dream/QueryDriver/helpers/kysely/migrationFolderPath.js +6 -1
  8. package/dist/cjs/src/dream/QueryDriver/helpers/kysely/runMigration.js +2 -2
  9. package/dist/cjs/src/dream/internal/saveDream.js +1 -1
  10. package/dist/cjs/src/dream/internal/softDeleteDream.js +1 -1
  11. package/dist/cjs/src/dream-app/helpers/globalModelKeyFromPath.js +5 -2
  12. package/dist/cjs/src/dream-app/helpers/globalSerializerKeyFromPath.js +5 -2
  13. package/dist/cjs/src/dream-app/helpers/importers/importModels.js +1 -0
  14. package/dist/cjs/src/dream-app/helpers/normalizeFilePath.js +3 -0
  15. package/dist/cjs/src/dream-app/index.js +3 -3
  16. package/dist/cjs/src/helpers/areEqual.js +2 -2
  17. package/dist/cjs/src/helpers/cli/ASTBuilder.js +2 -2
  18. package/dist/cjs/src/helpers/cloneDeepSafe.js +2 -2
  19. package/dist/cjs/src/helpers/customPgParsers.js +2 -2
  20. package/dist/cjs/src/helpers/loadRepl.js +2 -2
  21. package/dist/cjs/src/helpers/path/PathHelpers.js +27 -0
  22. package/dist/cjs/src/helpers/path/convertToFileURL.js +7 -0
  23. package/dist/cjs/src/helpers/path/windowsSafePath.js +22 -0
  24. package/dist/cjs/src/helpers/sortBy.js +2 -2
  25. package/dist/cjs/src/helpers/sqlAttributes.js +2 -2
  26. package/dist/cjs/src/helpers/stringCasing.js +2 -2
  27. package/dist/cjs/src/package-exports/errors.js +2 -1
  28. package/dist/cjs/src/package-exports/index.js +2 -2
  29. package/dist/cjs/src/package-exports/system.js +1 -0
  30. package/dist/cjs/src/serializer/SerializerRenderer.js +2 -2
  31. package/dist/cjs/src/types/calendardate.js +1 -0
  32. package/dist/cjs/src/types/datetime.js +1 -0
  33. package/dist/cjs/src/utils/datetime/CalendarDate.js +489 -0
  34. package/dist/cjs/src/utils/datetime/DateTime.js +919 -0
  35. package/dist/cjs/src/utils/datetime/helpers/isoTimeDecimalString.js +8 -0
  36. package/dist/cjs/src/utils/datetime/helpers/microsecondParts.js +16 -0
  37. package/dist/cjs/src/utils/datetime/helpers/replaceISOMicroseconds.js +10 -0
  38. package/dist/esm/src/Dream.js +10 -15
  39. package/dist/esm/src/db/dataTypes.js +1 -0
  40. package/dist/esm/src/db/index.js +2 -2
  41. package/dist/esm/src/dream/QueryDriver/Base.js +2 -2
  42. package/dist/esm/src/dream/QueryDriver/Kysely.js +2 -2
  43. package/dist/esm/src/dream/QueryDriver/helpers/kysely/checkForNeedToBeRunMigrations.js +2 -2
  44. package/dist/esm/src/dream/QueryDriver/helpers/kysely/migrationFolderPath.js +6 -1
  45. package/dist/esm/src/dream/QueryDriver/helpers/kysely/runMigration.js +2 -2
  46. package/dist/esm/src/dream/internal/saveDream.js +1 -1
  47. package/dist/esm/src/dream/internal/softDeleteDream.js +1 -1
  48. package/dist/esm/src/dream-app/helpers/globalModelKeyFromPath.js +5 -2
  49. package/dist/esm/src/dream-app/helpers/globalSerializerKeyFromPath.js +5 -2
  50. package/dist/esm/src/dream-app/helpers/importers/importModels.js +1 -0
  51. package/dist/esm/src/dream-app/helpers/normalizeFilePath.js +3 -0
  52. package/dist/esm/src/dream-app/index.js +3 -3
  53. package/dist/esm/src/helpers/areEqual.js +2 -2
  54. package/dist/esm/src/helpers/cli/ASTBuilder.js +2 -2
  55. package/dist/esm/src/helpers/cloneDeepSafe.js +2 -2
  56. package/dist/esm/src/helpers/customPgParsers.js +2 -2
  57. package/dist/esm/src/helpers/loadRepl.js +2 -2
  58. package/dist/esm/src/helpers/path/PathHelpers.js +27 -0
  59. package/dist/esm/src/helpers/path/convertToFileURL.js +7 -0
  60. package/dist/esm/src/helpers/path/windowsSafePath.js +22 -0
  61. package/dist/esm/src/helpers/sortBy.js +2 -2
  62. package/dist/esm/src/helpers/sqlAttributes.js +2 -2
  63. package/dist/esm/src/helpers/stringCasing.js +2 -2
  64. package/dist/esm/src/package-exports/errors.js +2 -1
  65. package/dist/esm/src/package-exports/index.js +2 -2
  66. package/dist/esm/src/package-exports/system.js +1 -0
  67. package/dist/esm/src/serializer/SerializerRenderer.js +2 -2
  68. package/dist/esm/src/types/calendardate.js +1 -0
  69. package/dist/esm/src/types/datetime.js +1 -0
  70. package/dist/esm/src/utils/datetime/CalendarDate.js +489 -0
  71. package/dist/esm/src/utils/datetime/DateTime.js +919 -0
  72. package/dist/esm/src/utils/datetime/helpers/isoTimeDecimalString.js +8 -0
  73. package/dist/esm/src/utils/datetime/helpers/microsecondParts.js +16 -0
  74. package/dist/esm/src/utils/datetime/helpers/replaceISOMicroseconds.js +10 -0
  75. package/dist/types/src/Dream.d.ts +2 -2
  76. package/dist/types/src/db/dataTypes.d.ts +2 -2
  77. package/dist/types/src/dream-app/helpers/normalizeFilePath.d.ts +1 -0
  78. package/dist/types/src/helpers/customPgParsers.d.ts +3 -2
  79. package/dist/types/src/helpers/path/PathHelpers.d.ts +21 -0
  80. package/dist/types/src/helpers/path/convertToFileURL.d.ts +1 -0
  81. package/dist/types/src/helpers/path/windowsSafePath.d.ts +20 -0
  82. package/dist/types/src/helpers/range.d.ts +2 -2
  83. package/dist/types/src/helpers/sort.d.ts +2 -2
  84. package/dist/types/src/helpers/sortBy.d.ts +2 -2
  85. package/dist/types/src/package-exports/errors.d.ts +2 -1
  86. package/dist/types/src/package-exports/index.d.ts +2 -2
  87. package/dist/types/src/package-exports/system.d.ts +1 -0
  88. package/dist/types/src/package-exports/types.d.ts +2 -0
  89. package/dist/types/src/types/associations/shared.d.ts +2 -2
  90. package/dist/types/src/types/associations/shared.ts +2 -2
  91. package/dist/types/src/types/calendardate.d.ts +4 -0
  92. package/dist/types/src/types/calendardate.ts +8 -0
  93. package/dist/types/src/types/datetime.d.ts +102 -0
  94. package/dist/types/src/types/datetime.ts +141 -0
  95. package/dist/types/src/types/dream.d.ts +2 -2
  96. package/dist/types/src/types/dream.ts +2 -2
  97. package/dist/types/src/types/moduleDeclarations/luxon.d.ts +5 -6
  98. package/dist/types/src/utils/datetime/CalendarDate.d.ts +375 -0
  99. package/dist/types/src/utils/datetime/DateTime.d.ts +597 -0
  100. package/dist/types/src/utils/datetime/helpers/isoTimeDecimalString.d.ts +4 -0
  101. package/dist/types/src/utils/datetime/helpers/microsecondParts.d.ts +10 -0
  102. package/dist/types/src/utils/datetime/helpers/replaceISOMicroseconds.d.ts +3 -0
  103. package/docs/assets/highlight.css +7 -0
  104. package/docs/assets/navigation.js +1 -1
  105. package/docs/assets/search.js +1 -1
  106. package/docs/classes/db.DreamMigrationHelpers.html +9 -9
  107. package/docs/classes/db.KyselyQueryDriver.html +33 -33
  108. package/docs/classes/db.PostgresQueryDriver.html +34 -34
  109. package/docs/classes/db.QueryDriverBase.html +32 -32
  110. package/docs/classes/errors.CheckConstraintViolation.html +3 -3
  111. package/docs/classes/errors.ColumnOverflow.html +3 -3
  112. package/docs/classes/errors.CreateOrFindByFailedToCreateAndFind.html +3 -3
  113. package/docs/classes/errors.DataIncompatibleWithDatabaseField.html +3 -3
  114. package/docs/classes/errors.DataTypeColumnTypeMismatch.html +3 -3
  115. package/docs/classes/errors.GlobalNameNotSet.html +3 -3
  116. package/docs/classes/errors.InvalidCalendarDate.html +7 -2
  117. package/docs/classes/errors.InvalidDateTime.html +17 -0
  118. package/docs/classes/errors.MissingSerializersDefinition.html +3 -3
  119. package/docs/classes/errors.NonLoadedAssociation.html +3 -3
  120. package/docs/classes/errors.NotNullViolation.html +3 -3
  121. package/docs/classes/errors.RecordNotFound.html +3 -3
  122. package/docs/classes/errors.ValidationError.html +3 -3
  123. package/docs/classes/index.CalendarDate.html +195 -2
  124. package/docs/classes/index.DateTime.html +375 -0
  125. package/docs/classes/index.Decorators.html +19 -19
  126. package/docs/classes/index.Dream.html +121 -121
  127. package/docs/classes/index.DreamApp.html +5 -5
  128. package/docs/classes/index.DreamTransaction.html +2 -2
  129. package/docs/classes/index.Env.html +2 -2
  130. package/docs/classes/index.Query.html +59 -59
  131. package/docs/classes/system.CliFileWriter.html +2 -2
  132. package/docs/classes/system.DreamBin.html +2 -2
  133. package/docs/classes/system.DreamCLI.html +5 -5
  134. package/docs/classes/system.DreamImporter.html +2 -2
  135. package/docs/classes/system.DreamLogos.html +2 -2
  136. package/docs/classes/system.DreamSerializerBuilder.html +8 -8
  137. package/docs/classes/system.ObjectSerializerBuilder.html +8 -8
  138. package/docs/classes/system.PathHelpers.html +13 -0
  139. package/docs/classes/utils.Encrypt.html +2 -2
  140. package/docs/classes/utils.Range.html +2 -2
  141. package/docs/functions/db.closeAllDbConnections.html +1 -1
  142. package/docs/functions/db.dreamDbConnections.html +1 -1
  143. package/docs/functions/db.untypedDb.html +1 -1
  144. package/docs/functions/db.validateColumn.html +1 -1
  145. package/docs/functions/db.validateTable.html +1 -1
  146. package/docs/functions/errors.pgErrorType.html +1 -1
  147. package/docs/functions/index.DreamSerializer.html +1 -1
  148. package/docs/functions/index.ObjectSerializer.html +1 -1
  149. package/docs/functions/index.ReplicaSafe.html +1 -1
  150. package/docs/functions/index.STI.html +1 -1
  151. package/docs/functions/index.SoftDelete.html +1 -1
  152. package/docs/functions/utils.camelize.html +1 -1
  153. package/docs/functions/utils.capitalize.html +1 -1
  154. package/docs/functions/utils.cloneDeepSafe.html +1 -1
  155. package/docs/functions/utils.compact.html +2 -2
  156. package/docs/functions/utils.groupBy.html +1 -1
  157. package/docs/functions/utils.hyphenize.html +1 -1
  158. package/docs/functions/utils.intersection.html +1 -1
  159. package/docs/functions/utils.isEmpty.html +1 -1
  160. package/docs/functions/utils.normalizeUnicode.html +1 -1
  161. package/docs/functions/utils.pascalize.html +1 -1
  162. package/docs/functions/utils.percent.html +1 -1
  163. package/docs/functions/utils.range-1.html +1 -1
  164. package/docs/functions/utils.round.html +1 -1
  165. package/docs/functions/utils.sanitizeString.html +1 -1
  166. package/docs/functions/utils.snakeify.html +1 -1
  167. package/docs/functions/utils.sort.html +1 -1
  168. package/docs/functions/utils.sortBy.html +1 -1
  169. package/docs/functions/utils.sortObjectByKey.html +1 -1
  170. package/docs/functions/utils.sortObjectByValue.html +1 -1
  171. package/docs/functions/utils.uncapitalize.html +1 -1
  172. package/docs/functions/utils.uniq.html +1 -1
  173. package/docs/interfaces/openapi.OpenapiDescription.html +2 -2
  174. package/docs/interfaces/openapi.OpenapiSchemaProperties.html +1 -1
  175. package/docs/interfaces/openapi.OpenapiSchemaPropertiesShorthand.html +1 -1
  176. package/docs/interfaces/openapi.OpenapiTypeFieldObject.html +1 -1
  177. package/docs/interfaces/types.BelongsToStatement.html +2 -2
  178. package/docs/interfaces/types.DecoratorContext.html +2 -2
  179. package/docs/interfaces/types.DreamAppInitOptions.html +2 -2
  180. package/docs/interfaces/types.DreamAppOpts.html +2 -2
  181. package/docs/interfaces/types.DurationObject.html +12 -0
  182. package/docs/interfaces/types.EncryptOptions.html +2 -2
  183. package/docs/interfaces/types.InternalAnyTypedSerializerRendersMany.html +2 -2
  184. package/docs/interfaces/types.InternalAnyTypedSerializerRendersOne.html +2 -2
  185. package/docs/interfaces/types.SerializerRendererOpts.html +2 -2
  186. package/docs/modules/db.html +1 -1
  187. package/docs/modules/errors.html +2 -1
  188. package/docs/modules/index.html +3 -4
  189. package/docs/modules/openapi.html +1 -1
  190. package/docs/modules/system.html +2 -1
  191. package/docs/modules/types.html +6 -2
  192. package/docs/modules/utils.html +1 -1
  193. package/docs/types/openapi.CommonOpenapiSchemaObjectFields.html +1 -1
  194. package/docs/types/openapi.OpenapiAllTypes.html +1 -1
  195. package/docs/types/openapi.OpenapiFormats.html +1 -1
  196. package/docs/types/openapi.OpenapiNumberFormats.html +1 -1
  197. package/docs/types/openapi.OpenapiPrimitiveBaseTypes.html +1 -1
  198. package/docs/types/openapi.OpenapiPrimitiveTypes.html +1 -1
  199. package/docs/types/openapi.OpenapiSchemaArray.html +1 -1
  200. package/docs/types/openapi.OpenapiSchemaArrayShorthand.html +1 -1
  201. package/docs/types/openapi.OpenapiSchemaBase.html +1 -1
  202. package/docs/types/openapi.OpenapiSchemaBody.html +1 -1
  203. package/docs/types/openapi.OpenapiSchemaBodyShorthand.html +1 -1
  204. package/docs/types/openapi.OpenapiSchemaCommonFields.html +1 -1
  205. package/docs/types/openapi.OpenapiSchemaExpressionAllOf.html +1 -1
  206. package/docs/types/openapi.OpenapiSchemaExpressionAnyOf.html +1 -1
  207. package/docs/types/openapi.OpenapiSchemaExpressionOneOf.html +1 -1
  208. package/docs/types/openapi.OpenapiSchemaExpressionRef.html +1 -1
  209. package/docs/types/openapi.OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
  210. package/docs/types/openapi.OpenapiSchemaInteger.html +1 -1
  211. package/docs/types/openapi.OpenapiSchemaNull.html +1 -1
  212. package/docs/types/openapi.OpenapiSchemaNumber.html +1 -1
  213. package/docs/types/openapi.OpenapiSchemaObject.html +1 -1
  214. package/docs/types/openapi.OpenapiSchemaObjectAllOf.html +1 -1
  215. package/docs/types/openapi.OpenapiSchemaObjectAllOfShorthand.html +1 -1
  216. package/docs/types/openapi.OpenapiSchemaObjectAnyOf.html +1 -1
  217. package/docs/types/openapi.OpenapiSchemaObjectAnyOfShorthand.html +1 -1
  218. package/docs/types/openapi.OpenapiSchemaObjectBase.html +1 -1
  219. package/docs/types/openapi.OpenapiSchemaObjectBaseShorthand.html +1 -1
  220. package/docs/types/openapi.OpenapiSchemaObjectOneOf.html +1 -1
  221. package/docs/types/openapi.OpenapiSchemaObjectOneOfShorthand.html +1 -1
  222. package/docs/types/openapi.OpenapiSchemaObjectShorthand.html +1 -1
  223. package/docs/types/openapi.OpenapiSchemaPrimitiveGeneric.html +1 -1
  224. package/docs/types/openapi.OpenapiSchemaShorthandExpressionAllOf.html +1 -1
  225. package/docs/types/openapi.OpenapiSchemaShorthandExpressionAnyOf.html +1 -1
  226. package/docs/types/openapi.OpenapiSchemaShorthandExpressionOneOf.html +1 -1
  227. package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializableRef.html +1 -1
  228. package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializerRef.html +1 -1
  229. package/docs/types/openapi.OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
  230. package/docs/types/openapi.OpenapiSchemaString.html +1 -1
  231. package/docs/types/openapi.OpenapiShorthandAllTypes.html +1 -1
  232. package/docs/types/openapi.OpenapiShorthandPrimitiveBaseTypes.html +1 -1
  233. package/docs/types/openapi.OpenapiShorthandPrimitiveTypes.html +1 -1
  234. package/docs/types/openapi.OpenapiTypeField.html +1 -1
  235. package/docs/types/system.DreamAppAllowedPackageManagersEnum.html +1 -1
  236. package/docs/types/types.CalendarDateDurationUnit.html +1 -0
  237. package/docs/types/types.Camelized.html +1 -1
  238. package/docs/types/types.DbConnectionType.html +1 -1
  239. package/docs/types/types.DbTypes.html +1 -1
  240. package/docs/types/types.DreamAssociationMetadata.html +1 -1
  241. package/docs/types/types.DreamAttributes.html +1 -1
  242. package/docs/types/types.DreamClassAssociationAndStatement.html +1 -1
  243. package/docs/types/types.DreamClassColumn.html +1 -1
  244. package/docs/types/types.DreamColumn.html +1 -1
  245. package/docs/types/types.DreamColumnNames.html +1 -1
  246. package/docs/types/types.DreamLogLevel.html +1 -1
  247. package/docs/types/types.DreamLogger.html +1 -1
  248. package/docs/types/types.DreamModelSerializerType.html +1 -1
  249. package/docs/types/types.DreamOrViewModelClassSerializerKey.html +1 -1
  250. package/docs/types/types.DreamOrViewModelSerializerKey.html +1 -1
  251. package/docs/types/types.DreamParamSafeAttributes.html +1 -1
  252. package/docs/types/types.DreamParamSafeColumnNames.html +1 -1
  253. package/docs/types/types.DreamSerializable.html +1 -1
  254. package/docs/types/types.DreamSerializableArray.html +1 -1
  255. package/docs/types/types.DreamSerializerKey.html +1 -1
  256. package/docs/types/types.DreamSerializers.html +1 -1
  257. package/docs/types/types.DreamVirtualColumns.html +1 -1
  258. package/docs/types/types.DurationUnit.html +4 -0
  259. package/docs/types/types.EncryptAlgorithm.html +1 -1
  260. package/docs/types/types.HasManyStatement.html +1 -1
  261. package/docs/types/types.HasOneStatement.html +1 -1
  262. package/docs/types/types.Hyphenized.html +1 -1
  263. package/docs/types/types.Pascalized.html +1 -1
  264. package/docs/types/types.PrimaryKeyType.html +1 -1
  265. package/docs/types/types.RoundingPrecision.html +1 -1
  266. package/docs/types/types.SerializerCasing.html +1 -1
  267. package/docs/types/types.SimpleObjectSerializerType.html +1 -1
  268. package/docs/types/types.Snakeified.html +1 -1
  269. package/docs/types/types.StrictInterface.html +1 -1
  270. package/docs/types/types.UpdateableAssociationProperties.html +1 -1
  271. package/docs/types/types.UpdateableProperties.html +1 -1
  272. package/docs/types/types.ValidationType.html +1 -1
  273. package/docs/types/types.ViewModel.html +1 -1
  274. package/docs/types/types.ViewModelClass.html +1 -1
  275. package/docs/types/types.WeekdayName.html +2 -0
  276. package/docs/types/types.WhereStatementForDream.html +1 -1
  277. package/docs/types/types.WhereStatementForDreamClass.html +1 -1
  278. package/docs/variables/index.DreamConst.html +1 -1
  279. package/docs/variables/index.ops.html +1 -1
  280. package/docs/variables/openapi.openapiPrimitiveTypes-1.html +1 -1
  281. package/docs/variables/openapi.openapiShorthandPrimitiveTypes-1.html +1 -1
  282. package/docs/variables/system.DreamAppAllowedPackageManagersEnumValues.html +1 -1
  283. package/docs/variables/system.primaryKeyTypes.html +1 -1
  284. package/package.json +9 -3
  285. package/dist/cjs/src/helpers/CalendarDate.js +0 -151
  286. package/dist/cjs/src/helpers/DateTime.js +0 -4
  287. package/dist/esm/src/helpers/CalendarDate.js +0 -151
  288. package/dist/esm/src/helpers/DateTime.js +0 -4
  289. package/dist/types/src/helpers/CalendarDate.d.ts +0 -56
  290. package/dist/types/src/helpers/DateTime.d.ts +0 -6
  291. package/dist/types/src/types/luxon/_util.d.ts +0 -20
  292. package/dist/types/src/types/luxon/datetime.d.ts +0 -1759
  293. package/dist/types/src/types/luxon/duration.d.ts +0 -494
  294. package/dist/types/src/types/luxon/info.d.ts +0 -217
  295. package/dist/types/src/types/luxon/interval.d.ts +0 -357
  296. package/dist/types/src/types/luxon/misc.d.ts +0 -67
  297. package/dist/types/src/types/luxon/settings.d.ts +0 -91
  298. package/dist/types/src/types/luxon/zone.d.ts +0 -172
  299. package/docs/types/index.DateTime.html +0 -1
  300. package/docs/variables/index.DateTime-1.html +0 -1
@@ -0,0 +1,375 @@
1
+ import { Zone } from 'luxon';
2
+ import { CalendarDateDurationLike, CalendarDateDurationUnit, CalendarDateUnit } from '../../types/calendardate.js';
3
+ import { type DateTimeFormatOptions, type DateTimeJSOptions, type DateTimeObject, type LocaleOptions, type WeekdayName } from '../../types/datetime.js';
4
+ import { DateTime } from './DateTime.js';
5
+ /**
6
+ * CalendarDate represents a date without time or timezone information.
7
+ */
8
+ export default class CalendarDate {
9
+ protected readonly dateTime: DateTime;
10
+ /**
11
+ * Creates a CalendarDate from a DateTime, year/month/day, or defaults to today in UTC.
12
+ * @param source - DateTime instance, year number, or null/undefined for today
13
+ * @param month - Month (1-12) when source is a year number
14
+ * @param day - Day of month when source is a year number
15
+ * @example
16
+ * ```ts
17
+ * new CalendarDate() // today
18
+ * new CalendarDate(DateTime.now()) // from DateTime
19
+ * new CalendarDate(2026, 2, 7) // February 7, 2026
20
+ * ```
21
+ */
22
+ constructor(source?: DateTime | number | null, month?: number, day?: number);
23
+ /**
24
+ * Create a CalendarDate from a DateTime instance.
25
+ * @param dateTime - A DateTime instance
26
+ * @returns A CalendarDate for the date portion of the DateTime
27
+ * @example
28
+ * ```ts
29
+ * CalendarDate.fromDateTime(DateTime.now())
30
+ * ```
31
+ */
32
+ static fromDateTime(dateTime: DateTime): CalendarDate;
33
+ /**
34
+ * Create a CalendarDate from a JavaScript Date.
35
+ * @param javascriptDate - A JavaScript Date instance
36
+ * @param options - Optional zone to interpret the date in
37
+ * @returns A CalendarDate for the date portion
38
+ * @example
39
+ * ```ts
40
+ * CalendarDate.fromJSDate(new Date())
41
+ * CalendarDate.fromJSDate(new Date(), { zone: 'America/New_York' })
42
+ * ```
43
+ */
44
+ static fromJSDate(javascriptDate: Date, { zone }?: {
45
+ zone?: string | Zone;
46
+ }): CalendarDate;
47
+ /**
48
+ * Create a CalendarDate from an ISO 8601 date string.
49
+ * @param str - ISO date string (e.g., '2026-02-07')
50
+ * @param options - Optional zone to interpret the date in (only affects ISO strings that include a time component)
51
+ * @returns A CalendarDate for the given date
52
+ * @throws {InvalidCalendarDate} When the ISO string is invalid
53
+ * @example
54
+ * ```ts
55
+ * CalendarDate.fromISO('2026-02-07')
56
+ * CalendarDate.fromISO('2026-02-07T09:00:00Z') // time portion ignored
57
+ * ```
58
+ */
59
+ static fromISO(str: string, { zone }?: {
60
+ zone?: string | Zone;
61
+ }): CalendarDate;
62
+ /**
63
+ * Create a CalendarDate from an SQL date string.
64
+ * @param str - SQL date string (e.g., '2026-02-07')
65
+ * @returns A CalendarDate for the given date
66
+ * @throws {InvalidCalendarDate} When the SQL string is invalid
67
+ * @example
68
+ * ```ts
69
+ * CalendarDate.fromSQL('2026-02-07')
70
+ * ```
71
+ */
72
+ static fromSQL(str: string): CalendarDate;
73
+ /**
74
+ * Create a CalendarDate from an object with date units.
75
+ * @param obj - Object with year, month, day properties
76
+ * @param opts - Optional zone/locale options
77
+ * @returns A CalendarDate for the given components
78
+ * @throws {InvalidCalendarDate} When date values are invalid
79
+ * @example
80
+ * ```ts
81
+ * CalendarDate.fromObject({ year: 2026, month: 2, day: 7 })
82
+ * ```
83
+ */
84
+ static fromObject(obj: DateTimeObject, opts?: DateTimeJSOptions): CalendarDate;
85
+ /**
86
+ * Returns a CalendarDate for today's date.
87
+ * @param options - Optional zone (defaults to UTC)
88
+ * @returns A CalendarDate for today
89
+ * @example
90
+ * ```ts
91
+ * CalendarDate.today()
92
+ * CalendarDate.today({ zone: 'America/New_York' })
93
+ * ```
94
+ */
95
+ static today({ zone }?: {
96
+ zone?: string | Zone;
97
+ }): CalendarDate;
98
+ /**
99
+ * Returns a CalendarDate for tomorrow's date.
100
+ * @param options - Optional zone (defaults to UTC)
101
+ * @returns A CalendarDate for tomorrow
102
+ * @example
103
+ * ```ts
104
+ * CalendarDate.tomorrow()
105
+ * CalendarDate.tomorrow({ zone: 'America/New_York' })
106
+ * ```
107
+ */
108
+ static tomorrow(options?: {
109
+ zone?: string | Zone;
110
+ }): CalendarDate;
111
+ /**
112
+ * Returns a CalendarDate for yesterday's date.
113
+ * @param options - Optional zone (defaults to UTC)
114
+ * @returns A CalendarDate for yesterday
115
+ * @example
116
+ * ```ts
117
+ * CalendarDate.yesterday()
118
+ * CalendarDate.yesterday({ zone: 'America/New_York' })
119
+ * ```
120
+ */
121
+ static yesterday(options?: {
122
+ zone?: string | Zone;
123
+ }): CalendarDate;
124
+ /**
125
+ * Returns the date as an ISO 8601 string.
126
+ * @returns ISO date string (e.g., '2026-02-07')
127
+ * @example
128
+ * ```ts
129
+ * CalendarDate.fromObject({ year: 2026, month: 2, day: 7 }).toISO() // '2026-02-07'
130
+ * ```
131
+ */
132
+ toISO(): string;
133
+ /**
134
+ * Returns the date as an SQL date string.
135
+ * @returns SQL date string (e.g., '2026-02-07')
136
+ * @example
137
+ * ```ts
138
+ * CalendarDate.fromObject({ year: 2026, month: 2, day: 7 }).toSQL() // '2026-02-07'
139
+ * ```
140
+ */
141
+ toSQL(): string;
142
+ /**
143
+ * Returns the date as an ISO string for JSON serialization.
144
+ * @returns ISO date string (e.g., '2026-02-07')
145
+ * @example
146
+ * ```ts
147
+ * JSON.stringify({ date: CalendarDate.today() })
148
+ * ```
149
+ */
150
+ toJSON(): string;
151
+ /**
152
+ * Returns the epoch milliseconds for the date at midnight UTC.
153
+ * @returns Unix timestamp in milliseconds
154
+ * @example
155
+ * ```ts
156
+ * CalendarDate.fromISO('2026-02-07').valueOf()
157
+ * ```
158
+ */
159
+ valueOf(): number;
160
+ /**
161
+ * Returns the date as an ISO date string (same as toISO).
162
+ * @returns ISO date string (e.g., '2026-02-07')
163
+ * @example
164
+ * ```ts
165
+ * CalendarDate.fromObject({ year: 2026, month: 2, day: 7 }).toISODate() // '2026-02-07'
166
+ * ```
167
+ */
168
+ toISODate(): string;
169
+ /**
170
+ * Returns a localized string representation of the date.
171
+ * @param formatOpts - Intl.DateTimeFormat options for formatting
172
+ * @param opts - Optional locale options
173
+ * @returns Localized date string
174
+ * @example
175
+ * ```ts
176
+ * CalendarDate.today().toLocaleString()
177
+ * CalendarDate.today().toLocaleString({ month: 'long', day: 'numeric', year: 'numeric' })
178
+ * ```
179
+ */
180
+ toLocaleString(formatOpts?: DateTimeFormatOptions, opts?: LocaleOptions): string;
181
+ /**
182
+ * Returns the date as an ISO string (same as toISO).
183
+ * @returns ISO date string (e.g., '2026-02-07')
184
+ * @example
185
+ * ```ts
186
+ * String(CalendarDate.today())
187
+ * ```
188
+ */
189
+ toString(): string;
190
+ /**
191
+ * Returns the underlying DateTime instance (at midnight UTC).
192
+ * @returns A DateTime representing this date at 00:00:00 UTC
193
+ * @example
194
+ * ```ts
195
+ * const dt = CalendarDate.today().toDateTime()
196
+ * ```
197
+ */
198
+ toDateTime(): DateTime;
199
+ /**
200
+ * Returns a JavaScript Date for this date (at midnight UTC).
201
+ * @returns A JavaScript Date instance
202
+ * @example
203
+ * ```ts
204
+ * const jsDate = CalendarDate.today().toJSDate()
205
+ * ```
206
+ */
207
+ toJSDate(): Date;
208
+ /**
209
+ * Gets the year.
210
+ * @returns The year number
211
+ * @example
212
+ * ```ts
213
+ * CalendarDate.fromISO('2026-02-07').year // 2026
214
+ * ```
215
+ */
216
+ get year(): number;
217
+ /**
218
+ * Gets the month (1-12).
219
+ * @returns The month number (1 = January, 12 = December)
220
+ * @example
221
+ * ```ts
222
+ * CalendarDate.fromISO('2026-02-07').month // 2
223
+ * ```
224
+ */
225
+ get month(): number;
226
+ /**
227
+ * Gets the day of the month.
228
+ * @returns The day number (1-31)
229
+ * @example
230
+ * ```ts
231
+ * CalendarDate.fromISO('2026-02-07').day // 7
232
+ * ```
233
+ */
234
+ get day(): number;
235
+ /**
236
+ * Returns the lowercase name of the weekday.
237
+ * @returns Weekday name: 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', or 'sunday'
238
+ * @example
239
+ * ```ts
240
+ * CalendarDate.fromISO('2026-02-09').weekdayName // 'monday' (Feb 9, 2026 is a Monday)
241
+ * CalendarDate.fromISO('2026-02-07').weekdayName // 'saturday'
242
+ * ```
243
+ */
244
+ get weekdayName(): WeekdayName;
245
+ /**
246
+ * Returns a new CalendarDate at the start of the given period.
247
+ * @param period - Unit to truncate to ('year', 'quarter', 'month', 'week', or 'day')
248
+ * @returns A CalendarDate at the start of the period
249
+ * @example
250
+ * ```ts
251
+ * CalendarDate.fromISO('2026-02-15').startOf('month') // 2026-02-01
252
+ * CalendarDate.fromISO('2026-02-15').startOf('year') // 2026-01-01
253
+ * ```
254
+ */
255
+ startOf(period: CalendarDateUnit): CalendarDate;
256
+ /**
257
+ * Returns a new CalendarDate at the end of the given period.
258
+ * @param period - Unit to extend to end of ('year', 'quarter', 'month', 'week', or 'day')
259
+ * @returns A CalendarDate at the end of the period
260
+ * @example
261
+ * ```ts
262
+ * CalendarDate.fromISO('2026-02-15').endOf('month') // 2026-02-28
263
+ * CalendarDate.fromISO('2026-02-15').endOf('year') // 2026-12-31
264
+ * ```
265
+ */
266
+ endOf(period: CalendarDateUnit): CalendarDate;
267
+ /**
268
+ * Returns a new CalendarDate with the given duration added.
269
+ * @param duration - Duration to add (object with years, months, weeks, days, etc.)
270
+ * @returns A new CalendarDate
271
+ * @example
272
+ * ```ts
273
+ * CalendarDate.fromISO('2026-02-07').plus({ days: 5 }) // 2026-02-12
274
+ * CalendarDate.fromISO('2026-02-07').plus({ months: 2 }) // 2026-04-07
275
+ * ```
276
+ */
277
+ plus(duration: CalendarDateDurationLike): CalendarDate;
278
+ /**
279
+ * Returns a new CalendarDate with the given duration subtracted.
280
+ * @param duration - Duration to subtract (object with years, months, weeks, days, etc.)
281
+ * @returns A new CalendarDate
282
+ * @example
283
+ * ```ts
284
+ * CalendarDate.fromISO('2026-02-07').minus({ days: 5 }) // 2026-02-02
285
+ * CalendarDate.fromISO('2026-02-07').minus({ months: 2 }) // 2025-12-07
286
+ * ```
287
+ */
288
+ minus(duration: CalendarDateDurationLike): CalendarDate;
289
+ /**
290
+ * Returns the latest CalendarDate from the given arguments.
291
+ * @param calendarDates - CalendarDates to compare
292
+ * @returns The latest CalendarDate
293
+ * @example
294
+ * ```ts
295
+ * CalendarDate.max(date1, date2, date3)
296
+ * ```
297
+ */
298
+ static max(...calendarDates: Array<CalendarDate>): CalendarDate;
299
+ /**
300
+ * Returns the earliest CalendarDate from the given arguments.
301
+ * @param calendarDates - CalendarDates to compare
302
+ * @returns The earliest CalendarDate
303
+ * @example
304
+ * ```ts
305
+ * CalendarDate.min(date1, date2, date3)
306
+ * ```
307
+ */
308
+ static min(...calendarDates: Array<CalendarDate>): CalendarDate;
309
+ /**
310
+ * Returns true if this and other are in the same unit of time.
311
+ * @param otherCalendarDate - CalendarDate to compare against
312
+ * @param period - Unit to check ('year', 'quarter', 'month', 'week', or 'day')
313
+ * @returns true if same period
314
+ * @example
315
+ * ```ts
316
+ * const d1 = CalendarDate.fromISO('2026-02-07')
317
+ * const d2 = CalendarDate.fromISO('2026-02-15')
318
+ * d1.hasSame(d2, 'month') // true
319
+ * d1.hasSame(d2, 'day') // false
320
+ * ```
321
+ */
322
+ hasSame(otherCalendarDate: CalendarDate, period: CalendarDateUnit): boolean;
323
+ /**
324
+ * Returns the difference between this CalendarDate and another in the specified unit.
325
+ * @param otherCalendarDate - CalendarDate to compare against
326
+ * @param duration - Unit for the difference ('years', 'quarters', 'months', 'weeks', or 'days')
327
+ * @returns Numeric difference in the specified unit
328
+ * @example
329
+ * ```ts
330
+ * const d1 = CalendarDate.fromISO('2026-02-07')
331
+ * const d2 = CalendarDate.fromISO('2026-02-15')
332
+ * d2.diff(d1, 'days') // 8
333
+ * d2.diff(d1, 'months') // 0
334
+ * ```
335
+ */
336
+ diff(otherCalendarDate: CalendarDate, duration: CalendarDateDurationUnit): number;
337
+ /**
338
+ * Returns the difference between this CalendarDate and today in the specified unit.
339
+ * @param duration - Unit for the difference ('years', 'quarters', 'months', 'weeks', or 'days')
340
+ * @returns Numeric difference in the specified unit (rounded up)
341
+ * @example
342
+ * ```ts
343
+ * const future = CalendarDate.today().plus({ days: 5 })
344
+ * future.diffNow('days') // approximately 5
345
+ * ```
346
+ */
347
+ diffNow(duration: CalendarDateDurationUnit): number;
348
+ /**
349
+ * Returns true if this CalendarDate equals another CalendarDate.
350
+ * @param otherCalendarDate - CalendarDate to compare
351
+ * @returns true if dates are equal
352
+ * @example
353
+ * ```ts
354
+ * const d1 = CalendarDate.fromISO('2026-02-07')
355
+ * const d2 = CalendarDate.fromISO('2026-02-07')
356
+ * d1.equals(d2) // true
357
+ * ```
358
+ */
359
+ equals(otherCalendarDate: CalendarDate): boolean;
360
+ }
361
+ /**
362
+ * Thrown when a CalendarDate is invalid (e.g., invalid input or date values).
363
+ * @param error - The original error (available as cause)
364
+ * @example
365
+ * ```ts
366
+ * try {
367
+ * CalendarDate.fromISO('invalid')
368
+ * } catch (e) {
369
+ * if (e instanceof InvalidCalendarDate) console.error(e.message)
370
+ * }
371
+ * ```
372
+ */
373
+ export declare class InvalidCalendarDate extends Error {
374
+ constructor(error: Error);
375
+ }