mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 06:18:51 +00:00
JS: Add some to-cstring converters for DateTime (#21912)
Add some to-cstring converters for DateTime Changelog update
This commit is contained in:
@@ -175,7 +175,7 @@
|
||||
type _ = float
|
||||
```
|
||||
|
||||
- - Added the `--legacy:verboseTypeMismatch` switch to get legacy type mismatch error messages.
|
||||
- Added the `--legacy:verboseTypeMismatch` switch to get legacy type mismatch error messages.
|
||||
|
||||
- The JavaScript backend now uses [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)
|
||||
for 64-bit integer types (`int64` and `uint64`) by default. As this affects
|
||||
@@ -310,9 +310,6 @@
|
||||
- Added `std/paths`, `std/dirs`, `std/files`, `std/symlinks` and `std/appdirs`.
|
||||
- Added `std/cmdline` for reading command line parameters.
|
||||
- Added `sep` parameter in `std/uri` to specify the query separator.
|
||||
- Added bindings to [`Array.shift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift)
|
||||
and [`queueMicrotask`](https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask)
|
||||
in `jscore` for JavaScript targets.
|
||||
- Added `UppercaseLetters`, `LowercaseLetters`, `PunctuationChars`, `PrintableChars` sets to `std/strutils`.
|
||||
- Added `complex.sgn` for obtaining the phase of complex numbers.
|
||||
- Added `insertAdjacentText`, `insertAdjacentElement`, `insertAdjacentHTML`,
|
||||
@@ -327,6 +324,11 @@
|
||||
- Added `safe` parameter to `base64.encodeMime`.
|
||||
- Added `parseutils.parseSize` - inverse to `strutils.formatSize` - to parse human readable sizes.
|
||||
- Added `minmax` to `sequtils`, as a more efficient `(min(_), max(_))` over sequences.
|
||||
- `std/jscore` for JavaScript targets:
|
||||
+ Added bindings to [`Array.shift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift)
|
||||
and [`queueMicrotask`](https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask).
|
||||
+ Added `toDateString`, `toISOString`, `toJSON`, `toTimeString`, `toUTCString` converters for `DateTime`.
|
||||
|
||||
|
||||
[//]: # "Deprecations:"
|
||||
- Deprecated `selfExe` for Nimscript.
|
||||
|
||||
@@ -95,20 +95,27 @@ proc getMilliseconds*(d: DateTime): int {.importcpp.}
|
||||
proc getMinutes*(d: DateTime): int {.importcpp.}
|
||||
proc getMonth*(d: DateTime): int {.importcpp.}
|
||||
proc getSeconds*(d: DateTime): int {.importcpp.}
|
||||
proc getYear*(d: DateTime): int {.importcpp.}
|
||||
proc getTime*(d: DateTime): int {.importcpp.}
|
||||
proc toString*(d: DateTime): cstring {.importcpp.}
|
||||
proc getTimezoneOffset*(d: DateTime): int {.importcpp.}
|
||||
proc getUTCDate*(d: DateTime): int {.importcpp.}
|
||||
proc getUTCDay*(d: DateTime): int {.importcpp.}
|
||||
proc getUTCFullYear*(d: DateTime): int {.importcpp.}
|
||||
proc getUTCHours*(d: DateTime): int {.importcpp.}
|
||||
proc getUTCMilliseconds*(d: DateTime): int {.importcpp.}
|
||||
proc getUTCMinutes*(d: DateTime): int {.importcpp.}
|
||||
proc getUTCMonth*(d: DateTime): int {.importcpp.}
|
||||
proc getUTCSeconds*(d: DateTime): int {.importcpp.}
|
||||
proc getUTCDay*(d: DateTime): int {.importcpp.}
|
||||
proc getTimezoneOffset*(d: DateTime): int {.importcpp.}
|
||||
proc getYear*(d: DateTime): int {.importcpp.}
|
||||
|
||||
proc setFullYear*(d: DateTime, year: int) {.importcpp.}
|
||||
|
||||
func toDateString*(d: DateTime): cstring {.importcpp.}
|
||||
func toISOString*(d: DateTime): cstring {.importcpp.}
|
||||
func toJSON*(d: DateTime): cstring {.importcpp.}
|
||||
proc toString*(d: DateTime): cstring {.importcpp.}
|
||||
func toTimeString*(d: DateTime): cstring {.importcpp.}
|
||||
func toUTCString*(d: DateTime): cstring {.importcpp.}
|
||||
|
||||
#JSON library
|
||||
proc stringify*(l: JsonLib, s: JsRoot): cstring {.importcpp.}
|
||||
proc parse*(l: JsonLib, s: cstring): JsRoot {.importcpp.}
|
||||
|
||||
Reference in New Issue
Block a user