ngb-date.d.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { NgbDateStruct } from './ngb-date-struct';
  2. /**
  3. * A simple class that represents a date that datepicker also uses internally.
  4. *
  5. * It is the implementation of the `NgbDateStruct` interface that adds some convenience methods,
  6. * like `.equals()`, `.before()`, etc.
  7. *
  8. * All datepicker APIs consume `NgbDateStruct`, but return `NgbDate`.
  9. *
  10. * In many cases it is simpler to manipulate these objects together with
  11. * [`NgbCalendar`](#/components/datepicker/api#NgbCalendar) than native JS Dates.
  12. *
  13. * See the [date format overview](#/components/datepicker/overview#date-model) for more details.
  14. *
  15. * @since 3.0.0
  16. */
  17. export declare class NgbDate implements NgbDateStruct {
  18. /**
  19. * The year, for example 2016
  20. */
  21. year: number;
  22. /**
  23. * The month, for example 1=Jan ... 12=Dec as in ISO 8601
  24. */
  25. month: number;
  26. /**
  27. * The day of month, starting with 1
  28. */
  29. day: number;
  30. /**
  31. * A **static method** that creates a new date object from the `NgbDateStruct`,
  32. *
  33. * ex. `NgbDate.from({year: 2000, month: 5, day: 1})`.
  34. *
  35. * If the `date` is already of `NgbDate` type, the method will return the same object.
  36. */
  37. static from(date: NgbDateStruct): NgbDate;
  38. constructor(year: number, month: number, day: number);
  39. /**
  40. * Checks if the current date is equal to another date.
  41. */
  42. equals(other: NgbDateStruct): boolean;
  43. /**
  44. * Checks if the current date is before another date.
  45. */
  46. before(other: NgbDateStruct): boolean;
  47. /**
  48. * Checks if the current date is after another date.
  49. */
  50. after(other: NgbDateStruct): boolean;
  51. }