1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
use super::check_status;
use crate::{sys, Result, Value};

pub struct JsDate(pub(crate) Value);

impl JsDate {
  #[inline]
  pub fn value_of(&self) -> Result<f64> {
    let mut timestamp: f64 = 0.0;
    check_status!(unsafe { sys::napi_get_date_value(self.0.env, self.0.value, &mut timestamp) })?;
    Ok(timestamp)
  }
}