Skip to content

kane-thornwyrd/do-date

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧰 Functions

⚙️ convertDateToDDate

Function Type
convertDateToDDate (d: Date) => DDate

Parameters:

  • d: the Date object to convert

⚙️ convertDDateToDate

Function Type
convertDDateToDate (d: DDate) => Date

Parameters:

  • d: the DDate object to convert

⚙️ compareDDate

If a is before b return DDATE_COMPARISON_VALUES.BEFORE

If a is the same as b return DDATE_COMPARISON_VALUES.SAME

If a is after b return DDATE_COMPARISON_VALUES.AFTER

Function Type
compareDDate (a: DDate, b: DDate) => DDateComparisonResult

Parameters:

  • a: first DDate to compare
  • b: second DDate to compare

⚙️ convertDDateStringToDDate

convert a DDateString to a DDate object

Function Type
convertDDateStringToDDate (dateString: string) => DDate

Parameters:

  • DDateString: that should looks like 2024-01-30|9:30:45:135:756

🔧 Constants

⚙️ defaultDDate

Constant Type
defaultDDate DDate

⚙️ DDATE_ABSOLUTE_FUTUR_VALUE

Constant Type
DDATE_ABSOLUTE_FUTUR_VALUE number

Examples:

for a DDate that is at the very final day of January:

const lastDayOfJanuary =
  {
    year: 2024,
    month: 1,
    day: DDATE_ABSOLUTE_FUTUR_VALUE,
    hour: 0,
    minute: 0,
    second: 0,
    millisecond: 0,
    microsecond: 0,
  }

but you can also have a DDate that will always be the very final moment of January:

const lastMomentOfJanuary =
  {
    year: 2024,
    month: 1,
    day: DDATE_ABSOLUTE_FUTUR_VALUE,
    hour: DDATE_ABSOLUTE_FUTUR_VALUE,
    minute: DDATE_ABSOLUTE_FUTUR_VALUE,
    second: DDATE_ABSOLUTE_FUTUR_VALUE,
    millisecond: DDATE_ABSOLUTE_FUTUR_VALUE,
    microsecond: DDATE_ABSOLUTE_FUTUR_VALUE,
  }

⚙️ DDATESTRING_REGEX

Constant Type
DDATESTRING_REGEX RegExp

Examples:

a DDateString looks like: 2024-01-30|9:30:45:135:756

🔩 Enum

⚙️ DDATE_COMPARISON_VALUES

Property Type Description
BEFORE -1
SAME 0
AFTER 1

About

the minimalist date storage and comparison library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors